app/Services/BillingServices.php
/**
     * Creates billing entry in database when a new customer is registered
     * @param $request
     * @param Account $account
     * @return mixed
     */
Creates billing entry in database when a new customer is registered
@param $request
@param Account $account
@return mixed
Creates billing entry in database when a new customer is registered @param $request @param Account $account @return mixed
public static function createUIBillingEntry($request, $accountID)
    {
        $todaysDate = Carbon::now()->toDateString();
        $billNumber = self::generateBillNumber();
        $finanicalYear = CommonServices::getFinancialYear();
        $billingStatusCode = self::getBillingStatusCode(
            $request->payable_amount,
            $request->payment_amount
        );
        $billingPeriod = $request->plan_start_date . "-" . $request->plan_end_date;
        return Billing::create([
            "bill_number" => $billNumber,
            "account_id" => $accountID,
            "status_code" => $billingStatusCode,
            "bill_issued_date" => $todaysDate,
            "bill_due_date" => $request->due_date,
            "bill_amount" => $request->payable_amount,
            "prev_due_amount" => 0, 
            "plan_id" => $request->plan_id, 
            "financial_year" => $finanicalYear,
            "billing_period" => $billingPeriod 
        ]);
    }
public static function createUIBillingEntry ( $ request , $ accountID ) { $ todaysDate = Carbon :: now ( ) -> toDateString ( ) ; $ billNumber = self :: generateBillNumber ( ) ; $ finanicalYear = CommonServices :: getFinancialYear ( ) ; $ billingStatusCode = self :: getBillingStatusCode ( $ request -> payable_amount , $ request -> payment_amount ) ; $ billingPeriod = $ request -> plan_start_date . " - " . $ request -> plan_end_date ; return Billing :: create ( [ " bill_number " => $ billNumber , " account_id " => $ accountID , " status_code " => $ billingStatusCode , " bill_issued_date " => $ todaysDate , " bill_due_date " => $ request -> due_date , " bill_amount " => $ request -> payable_amount , " prev_due_amount " => 0 , " plan_id " => $ request -> plan_id , " financial_year " => $ finanicalYear , " billing_period " => $ billingPeriod ] ) ; }
Creates billing entry in database when a new customer is registered
 @param $request
 @param Account $account
 @return mixed
Creates billing entry in database when a new customer is registered @param $request @param Account $account @return mixed
// new registration there will be zero outstanding // plan id from request //billing period (based on subscription start and end date) in billing table