Fix a problem in invoice where rounding issue cause an invoice that is fully paid to appear partially paid

This commit is contained in:
Dillon
2023-03-19 22:21:10 +08:00
parent f73b1d7fe3
commit 32591273f8
@@ -16,14 +16,17 @@ class CreatesPerfexCRMInvoice
*/
public function execute(InvoicePerfexCRMObject $invoicePerfexCRMObject) {
try{
$subtotal = floor($invoicePerfexCRMObject->getSubTotal() * 100) / 100;
$total = floor($invoicePerfexCRMObject->getTotal() * 100) / 100;
$data = [
'clientid' => $invoicePerfexCRMObject->getClientId(),
'number' => $invoicePerfexCRMObject->getNumber(),
'date' => $invoicePerfexCRMObject->getDate(),
'duedate' => $invoicePerfexCRMObject->getDueDate(),
'currency' => $invoicePerfexCRMObject->getCurrency(),
'subtotal' => number_format($invoicePerfexCRMObject->getSubTotal(), 2, '.', ''),
'total' => number_format($invoicePerfexCRMObject->getTotal(), 2, '.', ''),
'subtotal' => number_format($subtotal, 2, '.', ''),
'total' => number_format($total, 2, '.', ''),
'billing_street' => $invoicePerfexCRMObject->getBillingStreet(),
'project_id' => $invoicePerfexCRMObject->getProjectId(),
'allowed_payment_modes[0]' => 1,