示例#1
0
        $code[] = $orgdt[0]['dCreatedDate'];
        //
        $iv_val = $encobj->setEncValues($encKey, $encAlgo, $code, '');
    }
}
//}
// $limit = " LIMIT ".($page-1)*$REC_LIMIT_FRONT.", ".$REC_LIMIT_FRONT." ";
// print $where;
// and poh.iStatusID in (".$poUserStatusIds.")
$orderBy = " ioh.iInvoiceID ";
$jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_status_master sm on sm.iStatusID = ioh.iStatusID";
$jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_user ou on ou.iUserID = ioh.iBuyerID";
$jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_purchase_order_heading poh on poh.iPurchaseOrderID = ioh.iPurchaseOrderID";
$jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_invoice_otherinformation ioi on ioh.iInvoiceID=ioi.iInvoiceID ";
$fields = " ioh.*,sm.vStatus_" . LANG . " as status,CONCAT(ou.vFirstName,' ',ou.vLastName) as buyername, DATEDIFF(NOW(),ioh.dCreatedDate) as days,DATE_FORMAT(ioh.dIssueDate,'%Y-%m-%d') as dIssueDate,poh.vPONumber,poh.dCreateDate as podate,\r\n\t\t\t\tioi.tSourcingDocument, ioi.tGlobalAgreement, ioi.tPaymentTerms, ioi.tFOB, ioi.tDeliveryTerms, ioi.tShippingControl, ioi.tConditionsForPayment, ioi.tPenalties, ioi.tSpecialInstruction, ioi.tNote ";
$ExportArr = $poObj->getJoinTableInfo($jtbl, $fields, $where, $orderBy, '', $limit, 'yes');
$ExportArr = array_slice($ExportArr, 0, -1);
// prints($ExportArr);exit;
$sep = "\t,";
$down_tools = 'INVOICE';
// GET USER PROJECT MEMBER PERMISSION DETAIL
switch ($down_tools) {
    case 'INVOICE':
        $xmlArr = array('Header' => 'invoices', 'Arr' => $ExportArr);
        $TagArr = array('Supplier Company Name' => 'vSupplierName', 'Supplier Company ID' => 'iSupplierOrganizationID', 'Supplier Code' => 'vInvoiceSupplierCode', 'Invoice Supplier Code' => 'vInvSupplierCode', 'Related PO Code ' => 'vExtPOCode', 'Buyer Name' => 'vBuyerName', 'Buyer ID' => 'iBuyerOrganizationID', 'Buyer Contact Party ' => 'vBuyerContactParty', 'Invoice Code' => 'vInvoiceCode', 'Issue Date' => 'dIssueDate', 'Invioce Description' => 'tInvoiceDescription', 'Opening Unit' => 'iOpeningUnit', 'Supplier Order Num' => 'vSupplierOrderNum', 'Invoice Type' => 'eInvoiceType', 'Line Item Tax' => 'eLineItemTax', 'VAT' => 'fVAT', 'Other tax 1' => 'fOtherTax1', 'Freight' => 'vFreight', 'Miscellaneous' => 'tMiscellaneous', 'Discount Baseline' => 'dCashDiscountBaseline', 'Max Cash Discount Days' => 'iMaxCashDiscountDays', 'Max Cash Discount Percentage' => 'fMaxCashDiscountPercentage', 'Normal Cash Discount Days ' => 'iNormalCashDiscountDays', 'Normal Cash Discount Percentage' => 'iNormalCashDiscountPercentage', 'Bill To Party' => 'vBillToParty', 'Bill To AddLine 1' => 'vBillToAddLine1', 'Bill To AddLine 2' => 'vBillToAddLine2', 'Bill To City' => 'vBillToCity', 'Bill To Country' => 'vBillToCountry', 'Bill To State' => 'vBillToState', 'Bill To ZipCode' => 'vBillToZipCode', 'Bill To Contact Party' => 'vBillToContactParty', 'Bill To Contact Telephone' => 'vBillToContactTelephone', 'Currency' => 'vCurrency', 'Invoice Total' => 'fInvoiceTotal', 'Prepayment' => 'fPrePayment', 'Sourcing Document' => 'tSourcingDocument', 'Global Agreement' => 'tGlobalAgreement', 'Payment Terms' => 'tPaymentTerms', 'FOB' => 'tFOB', 'Delivery Terms' => 'tDeliveryTerms', 'Shipping Control' => 'tShippingControl', 'Conditions For Payment' => 'tConditionsForPayment', 'Penalties' => 'tPenalties', 'Special Instruction' => 'tSpecialInstruction', 'Note' => 'tNote');
        /*foreach($TagArr as $key=>$arr){
              $ss.= ''.$key.',';
          }
          echo   $ss;exit;
          */
        $repeat = array('CallFunc' => '$poObj->GetInvoiceItems', 'VariablePass' => 'iInvoiceID', 'repeatcsv' => 'Order Type,Item Description,Item Line No,Quantity,Unit Of Measure,Price,Amount,VAT,Other Tax,Sub Item Type,Sub Item Quantity,Sub Item Rate,Sub Item Amount,Line Total', 'Header' => 'items', 'XmlTagArr' => array('Order Type' => 'eInvoiceType', 'Item Description' => 'tDescription', 'Item Line No' => 'iLineNumber', 'Quantity' => 'iQuantity', 'Unit Of Measure' => 'vUnitOfMeasure', 'Price' => 'fPrice', 'Amount' => 'fAmount', 'VAT' => 'fVAT', 'Other Tax' => 'fOtherTax1', 'Sub Item Type' => 'eSublineType', 'Sub Item Quantity' => 'iSubQuantity', 'Sub Item Rate' => 'fSubRate', 'Sub Item Amount' => 'fSubAmount', 'Line Total' => 'fLineTotal'));
示例#2
0
    } else {
        $cursort_type = 'DESC';
    }
    $orderBy = " {$cursort} {$cursort_type}";
} else {
    $orderBy = " ioh.dCreatedDate DESC ";
}
## ENDS HERE ###
$limit = " LIMIT " . ($page - 1) * $REC_LIMIT_FRONT . ", " . $REC_LIMIT_FRONT . " ";
// echo $where;
$jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_purchase_order_heading poh on ioh.iPurchaseOrderID=poh.iPurchaseOrderID";
$jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_status_master sm on (IF(ioh.iBuyerOrganizationID={$curORGID},sm.iStatusID = ioh.iaStatusID,sm.iStatusID = ioh.iStatusID))";
$jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_user ou on ou.iUserID = ioh.iBuyerID";
// echo $where; exit;
$fields = " ioh.*,ioh.vInvoiceNumber,ioh.vInvoiceCode,ioh.fInvoiceTotal,sm.vStatus_" . LANG . " as status,CONCAT(ou.vFirstName,' ',ou.vLastName) as buyername, DATEDIFF(NOW(),ioh.dCreatedDate) as days ";
$activegroup = $invOrdderObj->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;
$smarty->assign('activegroup', $activegroup);
//$smarty->assign('orglist',$orglist);
$smarty->assign('isusts', $isusts);
$smarty->assign('count', $count);
示例#3
0
}
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();
}
if ($mode == 'delete') {
    $where = "AND iInvoiceID IN ({$val})";
    //$fields="ioh.*,(select org.vCompanyName from b2b_organization_master org where org.iOrganizationID=ioh.iBuyerOrganizationID) as vBuyerName";
    $fields = "*";
    $arr = $invObj->getJoinTableInfo("", $fields, $where);
    $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'] = calcGTzTime(date('Y-m-d H:i:s'), 'Y-m-d H:i:s');
        $invObj->setAllVar($data);
        $where = "iInvoiceID IN (" . $v['iInvoiceID'] . ")";
        $res = $invObj->updateData($data, $where);
        $link = SITE_URL_DUM . "invoiceview/" . $v['iInvoiceID'];
        $INVCODE = $v['vInvoiceCode'];
示例#4
0
    $pohObj = new PurchaseOrderHeading();
}
if (!isset($statusmasterObj)) {
    include_once SITE_CLASS_APPLICATION . "class.StatusMaster.php";
    $statusmasterObj = new StatusMaster();
}
$crtsts = $statusmasterObj->getDetails('*', " AND eFor='Invoice' AND vStatus_en='Create' ");
$stsdtls = $statusmasterObj->getDetails('*', " AND eFor='Invoice' AND vStatus_en='Rejected' ");
$rjtsts = $stsdtls[0]['iStatusID'];
$stsdtls = $statusmasterObj->getDetails('*', " AND eFor='Invoice' AND vStatus_en='Accepted' ");
$acptsts = $stsdtls;
$lang = $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_LANG'];
$stsdtls = $statusmasterObj->getDetails("*, vStatusMsg_{$lang} as vStatusMsg", " AND eFor='Invoice' AND vStatus_en='Issued' ");
$isusts = $stsdtls;
$fields = " ioh.*, ioh.vExtPOCode, (select vState from b2b_state_master sm where BINARY sm.vStateCode=ioh.vBillToState AND BINARY sm.vCountryCode=ioh.vBillToCountry) as vBillToState,\r\n\t\t\t\t(select vCountry from b2b_country_master cm where BINARY cm.vCountryCode=ioh.vBillToCountry) as vBillToCountry\t";
$invoiceData = $invOrderObj->getJoinTableInfo('', $fields, " AND iInvoiceID={$iInvoiceID} ");
$isdtls = $statusmasterObj->getDetails('*', " AND eFor='Invoice' AND vStatus_en='Issued' ");
$isdtls = $isdtls[0]['iStatusID'];
// pr($_SESSION); exit;
if (!(is_array($invoiceData) && count($invoiceData) > 0)) {
    header("Location: " . SITE_URL_DUM . "invoicelist");
    exit;
}
if ($uorg_type == 'Buyer2') {
    $b2us = $invOrderObj->getInvoiceRfq2Buyer2OrgIds($iInvoiceID);
    if (!in_array($curORGID, $b2us)) {
        header("Location: " . SITE_URL_DUM . "invoicelist");
        exit;
    }
} else {
    if ($invoiceData[0]['iBuyerOrganizationID'] != $curORGID && $invoiceData[0]['iSupplierOrganizationID'] != $curORGID) {
示例#5
0
#### ENDS HERE ###
// prints($vldmsg); exit;
*/
//$sql="select vOrganizationCode, vCompanyName from b2b_organization_master org,b2b_organization_user user where org.iOrganizationId=user.iOrganizationId and user.vUserName='******'";
//$sql="select vOrganizationCode, vCompanyName from b2b_organization_master org where org.iOrganizationId=$curORGID";
//$res=$dbobj->MySqlSelect($sql); //$curORGID
$orgdtls = $orgObj->select($curORGID);
$orgname = $orgdtls[0]['vCompanyName'];
$OrgCode = $orgdtls[0]['vOrganizationCode'];
// prints($orgname);exit;
$invdtls = array();
if ($view == 'edit') {
    // $invdtls = $invOrdObj->select($iInvoiceID);
    $fields = " ioh.*, poh.vPOCode ";
    $jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_purchase_order_heading poh on ioh.iPurchaseOrderID=poh.iPurchaseOrderID ";
    $invdtls = $invOrdObj->getJoinTableInfo($jtbl, $fields, " AND ioh.iInvoiceID={$iInvoiceID} ");
    $isdtls = $statusmasterObj->getDetails('*', " AND eFor='Invoice' AND vStatus_en='Issued' ");
    $isdtls = $isdtls[0]['iStatusID'];
    if ($invdtls[0]['iBuyerOrganizationID'] != $curORGID && $invdtls[0]['iSupplierOrganizationID'] != $curORGID) {
        header("Location: " . SITE_URL_DUM . "invoicelist/all");
        exit;
    } else {
        if ($invdtls[0]['iBuyerOrganizationID'] == $curORGID && $invdtls[0]['iStatusID'] < $isdtls && $invdtls[0]['eCreateByBuyer'] != 'Yes') {
            // && ! ($invdtls[0]['eCreateByBuyer']=='Yes' && ($invdtls[0]['iaStatusID']==0 || $invdtls[0]['iStatusID']==$rjtsts) )
            header("Location: " . SITE_URL_DUM . "invoicelist/all");
            exit;
        }
    }
    $borgdtls = $orgObj->select($invdtls[0]['iBuyerOrganizationID']);
    if ($invdtls[0]['iPurchaseOrderID'] > 0) {
        $podl = $pohObj->select($invdtls[0]['iPurchaseOrderID']);
示例#6
0
    }
    $orderBy = " {$cursort} {$cursort_type}";
} else {
    $orderBy = " ioh.dCreatedDate DESC ";
}
## ENDS HERE ###
$limit = " LIMIT " . ($page - 1) * $REC_LIMIT_FRONT . ", " . $REC_LIMIT_FRONT . " ";
// $where .= " AND ioh.iStatusID>=$isusts "; 	// AND ioh.iaStatusID!=$rsts
$where .= " AND (ioh.iStatusID>={$isusts} OR ioh.iaStatusID={$rsts}) ";
$where = $where . $whr;
// echo $where;
$jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_purchase_order_heading poh on ioh.iPurchaseOrderID=poh.iPurchaseOrderID";
$jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_status_master sm on sm.iStatusID = ioh.iaStatusID";
$jtbl .= " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_user ou on ou.iUserID = ioh.iBuyerID";
// echo $where; exit;
$activegroup = $invOrdderObj->getJoinTableInfo($jtbl, "ioh.*,ioh.vInvoiceNumber,ioh.vInvoiceCode,ioh.fInvoiceTotal,sm.vStatus_" . LANG . " as status,CONCAT(ou.vFirstName,' ',ou.vLastName) as buyername", $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('curORGID', $curORGID);
$smarty->assign('activegroup', $activegroup);
//$smarty->assign('orglist',$orglist);
$smarty->assign('count', $count);
示例#7
0
// --- 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} ";
    $jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master org on (ioh.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";
} else {
    //if($orgtype == 'Supplier') {
    $icndt = " AND ioh.iSupplierOrganizationID={$orgid} OR (ioh.iBuyerOrganizationID={$orgid} AND ioh.iaStatusID>={$invisu} AND ioh.iaStatusID!={$invrjt}) ";
    $jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master org on (ioh.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";
}
$latestio = $invordheadingObj->getJoinTableInfo($jtbl, $fields, $icndt, " ioh.dCreatedDate DESC ", ' ioh.iInvoiceID ', " LIMIT 0,2");
$tot_latestio = isset($latestio['tot']) ? $latestio['tot'] : "";
//prints($latestio); exit;
unset($latestio['tot']);
$smarty->assign("latestio", $latestio);
$smarty->assign("tot_latestio", $latestio);
// -----------------------------------------------------------------------------------------------------------
// prints($orgbyusrvrfy); exit;
$oadDetail = $orgUserObj->getDetails('tDashboard', ' AND iUserID = "' . $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ID'] . '" ', '', '', '');
$tDashboard = $oadDetail[0]['tDashboard'];
$smarty->assign("tDashboard", $tDashboard);
// --- Buyer2 Associations -----------------------------------------------------------------------------
if (isset($_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ORGTYPE']) && ($_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ORGTYPE'] == 'Buyer' || $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ORGTYPE'] == 'Both')) {
    $b2by_dtls = $generalobj->getTableInfo(" " . PRJ_DB_PREFIX . "_buyer2_buyer_association b2ba ", " AND b2ba.iBuyerId={$curORGID} ", "b2ba.*, (Select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=b2ba.iBuyer2Id) as vBuyer2,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t (Select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=b2ba.iBuyerId) as vBuyer", " LIMIT 0,1 ", " ORDER BY iAssociationId DESC ", "");
    $smarty->assign("b2by_dtls", $b2by_dtls);
    //