} if (!isset($iohObj)) { include_once SITE_CLASS_APPLICATION . "user/class.InvoiceOrderHeading.php"; $iohObj = new InvoiceOrderHeading(); } if (!isset($statusmasterObj)) { include_once SITE_CLASS_APPLICATION . "class.StatusMaster.php"; $statusmasterObj = new StatusMaster(); } if (!isset($orgObj)) { include_once SITE_CLASS_APPLICATION . "organization/class.Organization.php"; $orgObj = new Organization(); } // $poData=$pohObj->select($iPurchaseOrderID); $fields = " poh.*, (select vState from b2b_state_master sm where BINARY sm.vStateCode=poh.vShipToState AND BINARY sm.vCountryCode=poh.vShipToCountry) as vShipToState,\r\n\t\t\t\t(select vCountry from b2b_country_master cm where BINARY cm.vCountryCode=poh.vShipToCountry) as vShipToCountry,\r\n\t\t\t\t(select vState from b2b_state_master sm where BINARY sm.vStateCode=poh.vBillToState AND BINARY sm.vCountryCode=poh.vBillToCountry) as vBillToState,\r\n\t\t\t\t(select vCountry from b2b_country_master cm where BINARY cm.vCountryCode=poh.vBillToCountry) as vBillToCountry,\r\n\t\t\t\t(select org.vCompanyName from b2b_organization_master org where org.iOrganizationID=poh.iSupplierOrganizationID) as vSupplierName,\r\n\t\t\t\t(select CONCAT(usr.vFirstName,' ',usr.vLastName) as name from b2b_organization_user usr where usr.iUserID=poh.iSupplierID) as vSupplierContactParty "; $poData = $pohObj->getJoinTableInfo('', $fields, " AND iPurchaseOrderID={$iPurchaseOrderID} "); $isdtls = $statusmasterObj->getDetails('*', " AND eFor='PO' AND vStatus_en='Issued' "); $isdtls = $isdtls[0]['iStatusID']; if ($uorg_type == 'Buyer2') { $b2us = $pohObj->getPurchaseOrderRfq2Buyer2OrgIds($iPurchaseOrderID); if (!in_array($curORGID, $b2us)) { header("Location: " . SITE_URL_DUM . "invoicelist"); exit; } } else { if ($poData[0]['iBuyerOrganizationID'] != $curORGID && $poData[0]['iSupplierOrganizationID'] != $curORGID) { header("Location: " . SITE_URL_DUM . "polist/all"); exit; } else { if ($poData[0]['iSupplierOrganizationID'] == $curORGID && $poData[0]['iStatusID'] < $isdtls) { header("Location: " . SITE_URL_DUM . "polist/all");
// prints($Data); exit; unset($Data['supplierID']); if ($Data['eSaved'] != 'Yes') { $Data['eSaved'] = 'No'; } if ($view == '' || $view == 'add') { ### SERVER SIDE VALIDATION #### include SITE_CLASS_GEN . "class.validation.php"; $validation = new Validation(); $RequiredFiledArr = array('iBuyerOrganizationID' => $smarty->get_template_vars('LBL_SELECT') . " " . $smarty->get_template_vars('LBL_BUYER') . " " . $smarty->get_template_vars('LBL_COMPANY'), 'vBuyerContactParty' => $smarty->get_template_vars('LBL_SELECT') . " " . $smarty->get_template_vars('LBL_BUYER') . " " . $smarty->get_template_vars('LBL_CONTACT_PARTY'), 'eLineItemTax' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_LINE_ITEM_TAX'), 'vBillToParty' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_PARTY'), 'vBillToAddLine1' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_ADDR_LINE') . "1", 'vBillToCity' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_CITY'), 'vBillToCountry' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_COUNTRY'), 'vBillToState' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_STATE'), 'vBillToZipCode' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_ZIP_CODE'), 'vBillToContactParty' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_CONTACT_PARTY'), 'vBillToContactTelephoneCode' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_CONTACT_TELEPHONE') . " " . $smarty->get_template_vars('LBL_CODE'), 'vBillToContactTelephone' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_CONTACT_TELEPHONE'), 'vCurrency' => $smarty->get_template_vars('LBL_ENTER') . " " . $smarty->get_template_vars('LBL_CURRENCT')); $stsdtls = $statusmasterObj->getDetails('*', " AND vStatus_en='Accepted' AND eFor='PO' "); $sts = $stsdtls[0]['iStatusID']; $where = " AND iStatusID={$sts} "; $where .= " AND iSupplierOrganizationID={$curORGID} "; $where .= " AND (Select count(iInvoiceID) from b2b_inovice_order_heading where iPurchaseOrderID=poh.iPurchaseOrderID)=0 "; $POCodeData = $pohObj->getJoinTableInfo('', "poh.vPOCode as vTitle,poh.iPurchaseOrderID as Id", $where); if (is_array($POCodeData) && count($POCodeData) > 0) { // $RequiredFiledArr['iPurchaseOrderID'] = $smarty->get_template_vars('LBL_SELECT')." ".$smarty->get_template_vars('LBL_PURCHASE_ORDER'); } $resArr = $validation->isEmpty($RequiredFiledArr); $numdt = array(); //$numdt['iOpeningUnit'] = $Data['iOpeningUnit']; //$nvldmsg['iOpeningUnit'] = $smarty->get_template_vars('LBL_PRE_PAYMENT')." ".$smarty->get_template_vars('LBL_MUST_BE_NUMERIC'); $numdt['fVAT'] = $Data['fVAT']; $nvldmsg['fVAT'] = $smarty->get_template_vars('LBL_VAT') . " " . $smarty->get_template_vars('LBL_MUST_BE_NUMERIC'); $numdt['fPOTotal'] = $Data['fPOTotal']; $nvldmsg['fPOTotal'] = $smarty->get_template_vars('LBL_PO_TOTAL') . " " . $smarty->get_template_vars('LBL_MUST_BE_NUMERIC'); $numdt['fPrepayment'] = $Data['fPrepayment']; $nvldmsg['fPrepayment'] = $smarty->get_template_vars('LBL_PRE_PAYMENT') . " " . $smarty->get_template_vars('LBL_MUST_BE_NUMERIC'); $numdt['vBillToContactTelephone'] = str_replace('-', '', $Data['vBillToContactTelephone']); $nvldmsg['vBillToContactTelephone'] = $smarty->get_template_vars('LBL_BILL_TO') . " " . $smarty->get_template_vars('LBL_CONTACT_TELEPHONE') . " " . $smarty->get_template_vars('LBL_MUST_BE_NUMERIC');
} if (!isset($orgUserObj)) { include_once SITE_CLASS_APPLICATION . 'user/class.OrganizationUser.php'; $orgUserObj = new OrganizationUser(); } $sess_user_name = $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_NAME']; $sess_usertype_short = $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_USER_TYPE_SHORT']; if (!isset($userActionObj)) { include_once SITE_CLASS_APPLICATION . 'user/class.UserActionVerification.php'; $userActionObj = new UserActionVerification(); } //prints($_REQUEST);exit; if ($mode == 'delete' || $mode == 'deleteall') { $where = "AND iPurchaseOrderID IN ({$val})"; $fields = "poh.*,(select org.vCompanyName from b2b_organization_master org where org.iOrganizationID=poh.iSupplierOrganizationID) as vSupplierName"; $arr = $poObj->getJoinTableInfo("", $fields, $where); //prints($arr);exit; $userId = $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ID']; $orgId = $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ORGID']; $where = " AND iOrganizationID='{$orgId}'"; $emailArr = $orgUserObj->getDetails('vFirstName,vLastName,vEmail', $where); $where = ""; foreach ($arr as $k => $v) { $data['eDelete'] = 'Yes'; $data['iModifiedByID'] = $userId; // $data['eModifiedBy'] = $_SESSION['SESS_'.PRJ_CONST_PREFIX.'_USER_TYPE_SHORT']; // $data['dModifiedDate'] = date('Y-m-d H:i:s'); $poObj->setAllVar($data); $where = "iPurchaseOrderID IN (" . $v['iPurchaseOrderID'] . ")"; $res = $poObj->updateData($data, $where); $link = SITE_URL_DUM . "purchaseorderview/" . $v['iPurchaseOrderID'];
// echo $iv_val; exit; // prints($_POST); exit; // prints($iPoIds); exit; //$limit = " LIMIT ".($page-1)*$REC_LIMIT_FRONT.", ".$REC_LIMIT_FRONT." "; // print $where; exit; //and poh.iStatusID in (".$poUserStatusIds.") // echo $where; exit; $orderBy = "iPurchaseOrderID"; $jtbl = ''; $jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_status_master sm on sm.iStatusID = poh.iStatusID"; $jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_user ou on ou.iUserID = poh.iBuyerID"; $jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_user ous on ous.iUserID = poh.iSupplierID"; $jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_purchase_order_otherinformation poi on poh.iPurchaseOrderID=poi.iPurchaseOrderID "; // $jtbl.= " LEFT JOIN ".PRJ_DB_PREFIX."_purchase_order_heading poh on poh.iPurchaseOrderID = ioh.iPurchaseOrderID"; $fields = " poh.*,sm.vStatus_" . LANG . " as status,CONCAT(ou.vFirstName,' ',ou.vLastName) as buyername,CONCAT(ous.vFirstName,' ',ous.vLastName) as suppliername,DATE_FORMAT(dOrderDate,'%Y-%m-%d') as dOrderDate, DATEDIFF(NOW(),poh.dCreateDate) as days,\r\n\t\t\t\t'|' as '|',poi.tSourcingDocument, poi.tGlobalAgreement, poi.tPaymentTerms, poi.tFOB, poi.tDeliveryTerms, poi.tShippingControl, poi.tConditionsForPayment, poi.tPenalties, poi.tSpecialInstruction, poi.tNote "; $ExportArr = $poObj->getJoinTableInfo($jtbl, $fields, $where, $orderBy, '', $limit, 'yes'); $ExportArr = array_slice($ExportArr, 0, -1); //prints($ExportArr);exit; $sep = "\t,"; $down_tools = 'PO'; # $enc = ''; // GET USER PROJECT MEMBER PERMISSION DETAIL //Prints($ExportArr);exit; switch ($down_tools) { case 'PO': $xmlArr = array('Header' => 'purchaseOrder', 'Arr' => $ExportArr); /*$TagArr = array( 'po-num' => 'vPONumber', 'po-date' => 'dCreateDate', 'sender-id' => 'iSupplierID', 'receiver-id' => 'iBuyerID',
/*$jtbl = " LEFT JOIN ".PRJ_DB_PREFIX."_organization_master org on poh.iBuyerID=org.iOrganizationID LEFT JOIN ".PRJ_DB_PREFIX."_state_master st on org.vState=st.vStateCode LEFT JOIN ".PRJ_DB_PREFIX."_country_master cnt on org.vCountry=cnt.vCountryCode ";*/ // echo $orgtype; exit; $groupby = " "; $fields = " *, poh.dCreateDate as addDate , (select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=poh.iSupplierOrganizationID ) as supplierorg "; if ($orgtype == 'Supplier') { $pcndt = " AND poh.iSupplierOrganizationID={$orgid} AND poh.iaStatusID>={$poisu} AND poh.iaStatusID!={$porjt} "; $jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master org on (poh.iSupplierOrganizationID=org.iOrganizationID)\r\n\t\t\t\t LEFT JOIN " . PRJ_DB_PREFIX . "_state_master st on org.vState=st.vStateCode\r\n\t\t\t\t LEFT JOIN " . PRJ_DB_PREFIX . "_country_master cnt on org.vCountry=cnt.vCountryCode\r\n\t\t\t\t"; } else { // if($orgtype == 'Buyer') { $pcndt = " AND poh.iBuyerOrganizationID={$orgid} OR (poh.iSupplierOrganizationID={$orgid} AND poh.iaStatusID>={$poisu} AND poh.iaStatusID!={$porjt}) "; $jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master org on (poh.iBuyerOrganizationID=org.iOrganizationID)\r\n\t\t\t\t LEFT JOIN " . PRJ_DB_PREFIX . "_state_master st on org.vState=st.vStateCode\r\n\t\t\t\t LEFT JOIN " . PRJ_DB_PREFIX . "_country_master cnt on org.vCountry=cnt.vCountryCode\r\n\t\t\t\t"; } $latestpo = $poheadingObj->getJoinTableInfo($jtbl, $fields, $pcndt, " poh.dOrderDate DESC ", ' poh.iPurchaseOrderID ', " LIMIT 0,2"); $tot_latestpo = isset($latestpo['tot']) ? $latestpo['tot'] : ""; //prints($latestpo); exit; unset($latestpo['tot']); $smarty->assign("latestpo", $latestpo); $smarty->assign("tot_latestpo", $tot_latestpo); // ----------------------------------------------------------------------------------------------------------- // --- Invoice Order ----------------------------------------------------------------------------- /*$jtbl = " LEFT JOIN ".PRJ_DB_PREFIX."_organization_master org on ioh.iSupplierID=org.iOrganizationID LEFT JOIN ".PRJ_DB_PREFIX."_state_master st on org.vState=st.vStateCode LEFT JOIN ".PRJ_DB_PREFIX."_country_master cnt on org.vCountry=cnt.vCountryCode ";*/ $groupby = " "; $fields = " *, ioh.dCreatedDate as addDate , (select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=ioh.iBuyerOrganizationID ) as buyerorg "; if ($orgtype == 'Buyer') { $icndt = " AND ioh.iBuyerOrganizationID={$orgid} AND ioh.iaStatusID>={$invisu} AND ioh.iaStatusID!={$invrjt} ";
} $orderBy = " {$cursort} {$cursort_type}"; } else { $orderBy = " poh.dCreateDate DESC "; } ## ENDS HERE ### $limit = " LIMIT " . ($page - 1) * $REC_LIMIT_FRONT . ", " . $REC_LIMIT_FRONT . " "; // $where .= " AND poh.iStatusID>=$isusts "; // AND poh.iaStatusID!=$rsts $where .= " AND (poh.iStatusID>={$isusts} OR poh.iaStatusID={$rsts}) "; $where = $where . $whr; // echo $where; exit; //and poh.iStatusID in (".$poUserStatusIds.") $jtbl = ''; $jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_status_master sm on sm.iStatusID = poh.iaStatusID "; $jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_user ou on ou.iUserID = poh.iBuyerID"; $activegroup = $poObj->getJoinTableInfo($jtbl, " poh.*,(select org.vCompanyName from b2b_organization_master org where org.iOrganizationID=poh.iSupplierOrganizationID) as vSupplierName,sm.vStatus_" . LANG . " as status,CONCAT(ou.vFirstName,' ',ou.vLastName) as buyername, DATEDIFF(NOW(),poh.dCreateDate) as days ", $where, $orderBy, '', $limit, 'yes'); // prints($activegroup);exit; //$orglist = $orgGroupObj->getDetails_PG('*',$where,$orderBy,'',$limit); $count = $activegroup['tot']; unset($activegroup['tot']); if (!isset($pgajxobj)) { require_once SITE_CLASS_GEN . "class.paging-ajax.php"; $pgajxobj = new Paging($count, $page, "listgroup", $REC_LIMIT_FRONT); } $paging = $pgajxobj->getListPG($page); $pgmsg = $pgajxobj->setMessage("Records"); //echo $paging; exit; $smarty->assign('acptsts', $acptsts); $smarty->assign('poObj', $poObj); $smarty->assign('curORGID', $curORGID); $smarty->assign('activegroup', $activegroup);
$orderBy = " {$cursort} {$cursort_type}"; } else { $orderBy = " poh.dCreateDate DESC "; } // echo $orderBy; exit; ## ENDS HERE ### $limit = " LIMIT " . ($page - 1) * $REC_LIMIT_FRONT . ", " . $REC_LIMIT_FRONT . " "; // print $where; $where = $where . $whr; // echo $where; exit; //and poh.iStatusID in (".$poOrgStatusIds.") $jtbl = ""; $jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_status_master sm on (IF(poh.iSupplierOrganizationID={$curORGID},sm.iStatusID = poh.iaStatusID,sm.iStatusID = poh.iStatusID)) "; $jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_user ou on ou.iUserID = poh.iBuyerID"; $fields = " poh.*,(select org.vCompanyName from b2b_organization_master org where org.iOrganizationID=poh.iSupplierOrganizationID) as vSupplierName,sm.vStatus_" . LANG . " as status,CONCAT(ou.vFirstName,' ',ou.vLastName) as buyername, DATEDIFF(NOW(),poh.dCreateDate) as days "; $activegroup = $poObj->getJoinTableInfo($jtbl, $fields, $where, $orderBy, '', $limit, 'yes'); // prints($activegroup);exit; //$orglist = $orgGroupObj->getDetails_PG('*',$where,$orderBy,'',$limit); $count = $activegroup['tot']; unset($activegroup['tot']); if (!isset($pgajxobj)) { require_once SITE_CLASS_GEN . "class.paging-ajax.php"; $pgajxobj = new Paging($count, $page, "listgroup", $REC_LIMIT_FRONT); } $paging = $pgajxobj->getListPG($page); $pgmsg = $pgajxobj->setMessage("Records"); //echo $paging; exit; $rejectStatusID = $statusmasterObj->getDetails('iStatusID', ' AND vStatus_en="Rejected" AND eFor="PO"'); $rejectStatusID = $rejectStatusID[0]['iStatusID']; $deletepo = ""; if ($poStatus == $rejectStatusID) {