$Data['vSupplierAddLine1'] = $supplierOrgDtls[0]['vAddressLine1']; $Data['vSupplierAddLine2'] = $supplierOrgDtls[0]['vAddressLine2']; $Data['vSupplierZipCode'] = $supplierOrgDtls[0]['vZipcode']; $Data['vSupplierState'] = $supplierOrgDtls[0]['vState']; $Data['vSupplierCountry'] = $supplierOrgDtls[0]['vCountry']; $Data['vInvoiceSupplierCode'] = $supplierOrgDtls[0]['vOrganizationCode']; $Data['vSupplierContactTelephone'] = $supplierOrgDtls[0]['vPhone']; $vItmCode = $pohObj->getUniqueCode(); $Data['vInvoiceCode'] = $vItmCode; $vInvoiceNumber = "INV" . $vItmCode . "-" . trim($Data['vInvoiceSupplierCode']); $Data['vInvoiceNumber'] = $vInvoiceNumber; if (trim($Data['eSaved']) == '') { $Data['eSaved'] = 'No'; } $pohObj->setAllVar($Data); $dup = $pohObj->chkDuplicate('vInvoiceNumber', $Data); // prints($Data); exit; if ($dup > 0) { $ids = $pohObj->updateData($Data, " iInvoiceID = {$dup} "); $id = $dup; if ($ids > 0) { $scs = 'y'; } //Prints("upd->".$id); } else { $id = $pohObj->insert(); if ($id > 0) { $scs = 'y'; } //Prints("insrt->".$id); }