$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); } if ($id > 0) { $Data_pref['iInvoiceID'] = $id; $rs = $ioprefObj->insert($Data_pref); } if ($val['items']) { $ItemArr = $val['items']; } else { $ItemArr = $itemval[$key]; } if (is_array($ItemArr)) { foreach ($ItemArr as $itemkey => $itemvals) { $Data_item = array(); $it = 0; foreach ($itemTagArr as $itemkey1 => $itemval1) { if ($type == '.xml') { $itemkey1 = strtolower(str_replace(" ", "", $itemkey1)); $Data_item[$itemval1] = trim($itemvals[$itemkey1]); } else {
include_once SITE_CLASS_APPLICATION . "user/class.InvoiceOtherInformation.php"; $ioprefObj = new InvoiceOtherInformation(); } $Data = $_POST['Data']; $eFrom = $Data['eFrom']; unset($Data['eFrom']); $iInvoiceID = $_POST['iInvoiceID']; $Data['iInvoiceID'] = $iInvoiceID; //prints($_POST); exit; $ioextdtls = $ioprefObj->getDetails("*", " AND iInvoiceID={$iInvoiceID} "); // prints($ioextdtls); exit; if (is_array($ioextdtls) && count($ioextdtls) > 0) { $rs = $ioprefObj->updateData($Data, "iInvoiceID={$iInvoiceID}"); $msg = "rus"; } else { $rs = $ioprefObj->insert($Data); $msg = "ras"; } $eSaved = $_POST['eSaved']; $_SESSION['invadd'] = 'yes'; if ($rs > 0) { if ($eSaved == 'Yes') { $dtl['eSaved'] = $eSaved; $wh_cn = "iInvoiceID={$iInvoiceID}"; $rs = $iohObj->updateData($dtl, $wh_cn); if ($eFrom == "Next") { $redirecturl = SITE_URL_DUM . "invoiceadditems/{$iInvoiceID}/sucss"; } else { $redirecturl = SITE_URL_DUM . "invoicelist/{$msg}"; } $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_MSG'] = $msg;
} } */ $icstsdtls = $statusmasterObj->getDetails('*', " AND eFor='Invoice' AND vStatus_en='Create' "); $invdt['iStatusID'] = $icstsdtls[0]['iStatusID']; $invdt['eSaved'] = 'Yes'; /* } else { $invisusts = $statusmasterObj->getDetails('*'," AND eFor='Invoice' AND vStatus_en='Issued' "); $invdt['iStatusID'] = $invisusts[0]; } */ // prints($invdt); exit; $iohObj->setAllVar($invdt); $in = $iohObj->insert(); $popref = $poprefObj->getDetails('*', " AND iPurchaseOrderID={$iPurchaseOrderID} "); $popref[0]['iInvoiceID'] = $in; unset($popref[0]['iPurchaseOrderID']); $iprf = $ioprefObj->insert($popref); $poitems = $poLineObj->getDetails('*', " AND iPurchaseOrderID={$iPurchaseOrderID}"); // prints($poitems); exit; for ($l = 0; $l < count($poitems); $l++) { $invItems = $poitems[$l]; $invItems['iRelatedPurchaseOrderLineID'] = $invItems['iOrderLineID']; unset($invItems['iOrderLineID']); unset($invItems['dETA']); unset($invItems['iRelatedInvoiceLineID']); // $vItemCode = $invItems['vItemCode']; // prints($vItemCode); exit; // $invitmdtl = $invLineObj->getDetails('*'," AND vItemCode=$vItemCode"); /* if(count($invitmdtl) > 0) { $vItemCode = $generalobj->getUniqueCode(PRJ_DB_PREFIX."_invoice_detail_line","vItemCode"); } */ $vItemCode = $invLineObj->getUniqueCode();