| Server IP : 138.197.176.125 / Your IP : 216.73.216.41 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/crest/modules/Invoice/ |
Upload File : |
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
function handleSaleInvoiceRel($entityData){
$adb = PearDatabase::getInstance();
$moduleName = $entityData->getModuleName();
$wsId = $entityData->getId();
$parts = explode('x', $wsId);
$record_id = $parts[1];
if ($record_id) {
$invoiceRecordModel = Vtiger_Record_Model::getInstanceById($record_id);
$salesorder_id = $invoiceRecordModel->get('salesorder_id');
$grand_total_in = $invoiceRecordModel->get('hdnGrandTotal');
$grand_total_fin = number_format($grand_total_in,2);
$total_invoiced_final_amount = str_replace(',', '', $grand_total_fin);
$RecordModule = Vtiger_Record_Model::getInstanceById($salesorder_id);
$total_paid_amount = $RecordModule->get('total_paid_amount');
$grand_total_so = $RecordModule->get('hdnGrandTotal');
$total_uninvoiced_amount = $grand_total_so - $grand_total_in;
$total_unpaid_amount = $total_invoiced_final_amount - $total_paid_amount;
$check_mail = $adb->pquery("UPDATE vtiger_salesorder SET total_invoiced_amount=?,total_uninvoiced_amount=?,total_unpaid_amount = ?,total_paid_amount=? WHERE salesorderid=?",array($total_invoiced_final_amount,$total_uninvoiced_amount,$total_unpaid_amount,0,$salesorder_id));
}
}
?>