0

I'm having trouble finding the option to send GST for each line item when creating a bill in XERO.

Currently, I'm using SKD and the solution is functioning properly, with the exception of sending the GST parameter.

Although I am able to insert records from my application to XERO, the GST on expenses is displaying for all subcontractors I have sent.

Image demonstrating GST

The code snippet works well, but I would like to include GST and a link to a PDF document that will be uploaded for the invoice.

foreach($arrInvoiceDetails as $invoice)
    {
        $strDesc = "{$invoice['project']} - {$invoice['worktype']}";
        if(empty($invoice['project']))
            $strDesc = getDayType($invoice['dayType']); 
        
        $hours = ($invoice["endTime"] - $invoice["startTime"] ) / 3600;
        $strHours = number_format((float)$hours, 2, '.', '');
        $lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
        $lineItem->setDescription($strDesc);
        $lineItem->setQuantity($strHours);
        $lineItem->setUnitAmount($invoice['wage']);
        $lineItem->setAccountCode('311');
        $arrItems[]  = $lineItem;
    }

    $newinvoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
    $newinvoice->setType(XeroAPI\XeroPHP\Models\Accounting\Invoice::TYPE_ACCPAY);
    $newinvoice->setContact($contact);
    $newinvoice->setDate(date('Y-m-d'));
    $newinvoice->setLineItems($arrItems);
    $strRef = "LOCAL-INV-{$inv['id']}";
    $newinvoice->setReference($strRef);
    $newinvoice->setStatus(XeroAPI\XeroPHP\Models\Accounting\Invoice::STATUS_DRAFT);
    $newinvoice->setDueDate(date('Y-m-d',$inv['due_date']));
    $arrNewInvoices[] = $newinvoice;
}

I would like if someone give me a hint how to do so

0 Answers0