示例#1
0
<?php

include S_SECTIONS . "/member/memberaccess.php";
if (!isset($pohObj)) {
    include_once SITE_CLASS_APPLICATION . "user/class.PurchaseOrderHeading.php";
    $pohObj = new PurchaseOrderHeading();
}
if (!isset($poLineObj)) {
    include_once SITE_CLASS_APPLICATION . "user/class.PurchaseOrderLine.php";
    $poLineObj = new PurchaseOrderLine();
}
if (!isset($statusmasterObj)) {
    include_once SITE_CLASS_APPLICATION . "class.StatusMaster.php";
    $statusmasterObj = new StatusMaster();
}
if (!isset($countryObj)) {
    include_once SITE_CLASS_APPLICATION . "class.Country.php";
    $countryObj = new Country();
}
$poid = $_GET['id'];
//$msg=$_REQUEST['msg'];
if (isset($_SESSION['SESS_' . PRJ_CONST_PREFIX . '_MSG'])) {
    $msg = $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_MSG'];
    unset($_SESSION['SESS_' . PRJ_CONST_PREFIX . '_MSG']);
}
if ($msg == 'ras') {
    $msg = $smarty->get_template_vars('MSG_ADD_SUCC');
} elseif ($msg == 'raserr') {
    $msg = $smarty->get_template_vars('MSG_ADD_ERR');
} elseif ($msg == 'rus') {
    $msg = $smarty->get_template_vars('MSG_UPDATE_SUCC');
示例#2
0
}
if (!isset($userActionObj)) {
    include_once SITE_CLASS_APPLICATION . 'user/class.UserActionVerification.php';
    $userActionObj = new UserActionVerification();
}
if (!isset($sendMail)) {
    include SITE_CLASS_GEN . "class.sendmail.php";
    $sendMail = new SendPHPMail();
}
if (!isset($pohObj)) {
    include_once SITE_CLASS_APPLICATION . "user/class.PurchaseOrderHeading.php";
    $pohObj = new PurchaseOrderHeading();
}
if (!isset($poLineObj)) {
    include_once SITE_CLASS_APPLICATION . "user/class.PurchaseOrderLine.php";
    $poLineObj = new PurchaseOrderLine();
}
if (!isset($invAttachmentObj)) {
    include_once SITE_CLASS_APPLICATION . "user/class.InvoiceOrderAttachment.php";
    $invAttachmentObj = new InvoiceOrderAttachment();
}
if (!isset($imgObj)) {
    include_once SITE_CLASS_GEN . "class.imagecrop.php";
    $imgObj = new imagecrop();
}
$totusrs = $orgUsrObj->getDetails(" COUNT(*) as tot ", " AND iOrganizationID={$curORGID} AND eUserType='User'");
$totusrs = $totusrs[0]['tot'];
$ordt = $orgUsrObj->getDetails('*', " AND iOrganizationID={$curORGID} AND eUserType='Admin' AND eStatus='Active'");
$org = $orgObj->select($curORGID);
$smdt = $secManObj->getDetails('*', " AND iASMID=" . $org[0]['iASMID'] . " AND eStatus='Active'");
if (is_array($smdt) && is_array($ordt)) {
 function getProductRows()
 {
     $return_array = array();
     if ($this->id != "") {
         $purchaseorderLine = new PurchaseOrderLine();
         $return_array = $purchaseorderLine->get_full_list("id", "purchaseorderid='" . $this->id . "'");
     }
     return $return_array;
 }
 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'modules/PurchaseOrders/PurchaseOrder.php';
     require_once 'modules/PurchaseOrderLines/PurchaseOrderLine.php';
     require_once 'log4php/LoggerManager.php';
     require_once 'include/formbase.php';
     require_once 'include/TimeDate.php';
     $timedate = new TimeDate();
     $focus = new PurchaseOrder();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (!ACLController::checkAccess($focus->module_dir, 'edit', $focus->isOwner($current_user->id))) {
         ACLController::displayNoAccess(true);
     }
     if (empty($_REQUEST['status']) || $_REQUEST['status'] == 'off') {
         $focus->status = 0;
     } else {
         $focus->status = 1;
     }
     //echo "post length:".count($_POST);
     //echo "product_count:".$count."<br>";
     //echo "cost_price num:".count($_POST["cost_price"])."<br";
     $return_id = $focus->save();
     $purchaseorderLine1 = new PurchaseOrderLine();
     $purchaseorderLine1->mark_deletedByPurchaseOrderid($return_id);
     $count = count($_POST);
     $keys = array_keys($_POST);
     $sum = 0;
     for ($i = 0; $i < $count; $i++) {
         if (substr_count($keys[$i], "materialname_") > 0) {
             $index = substr($keys[$i], strpos($keys[$i], "_") + 1);
             $materialid = $_POST["materialid_" . $index];
             $paperid = $_POST["paperid_" . $index];
             if (!isset($materialid) || empty($materialid) && !isset($paperid) && empty($paperid)) {
                 continue;
             }
             $number = $_POST["number_" . $index];
             $materialname = $_POST["materialname_" . $index];
             $measure = $_POST["measure_" . $index];
             $unit = $_POST["unit_" . $index];
             $singlep = $_POST["singlep_" . $index];
             $price = $_POST["price_" . $index];
             $purchaseorderLine = new PurchaseOrderLine();
             $purchaseorderLine->number = $number;
             $purchaseorderLine->materialid = $materialid;
             $purchaseorderLine->paperid = $paperid;
             $purchaseorderLine->materialname = $materialname;
             $purchaseorderLine->measure = $measure;
             $purchaseorderLine->unit = $unit;
             $purchaseorderLine->singlep = $singlep;
             $purchaseorderLine->price = $price;
             $purchaseorderLine->purchaseorderid = $return_id;
             $purchaseorderLine->save();
         }
     }
     $count = $_POST["product_count"];
     //	$GLOBLES['log']->debug("Saved record with id of ".$return_id);
     if ($redirect) {
         $this->handleRedirect($return_id);
     } else {
         return $focus;
     }
 }
示例#5
0
 function __construct($orderId, $date, $supplierid, $total, $user)
 {
     $this->id = $orderId;
     $this->transactionId = $orderId;
     $this->date = $date;
     $this->type = 'Purchase Order';
     //$this->description = 'Order for items';
     $this->party = Supplier::GetSupplier($supplierid);
     $this->amount = floatval($total);
     $this->total = floatval($total);
     if (is_null($user)) {
         $this->user = SessionManager::GetUsername();
     } else {
         $this->user = $user;
     }
     $this->lineItems = PurchaseOrderLine::GetOrderItems($orderId);
     $this->description = '';
     foreach ($this->lineItems as $item) {
         $this->description .= $item->quantity . ' x ' . $item->itemName . ', ';
     }
 }
<?php

if (!isset($poLineObj)) {
    include_once SITE_CLASS_APPLICATION . "user/class.PurchaseOrderLine.php";
    $poLineObj = new PurchaseOrderLine();
}
if (!isset($orgObj)) {
    include_once SITE_CLASS_APPLICATION . "organization/class.Organization.php";
    $orgObj = new Organization();
}
if (!isset($pohObj)) {
    include_once SITE_CLASS_APPLICATION . "user/class.PurchaseOrderHeading.php";
    $pohObj = new PurchaseOrderHeading();
}
$eOrderType = $_POST['eOrderType'];
$iPurchaseOrderID = $_POST['iPurchaseOrderID'];
if (is_array($_POST['vItemCode']) && is_array($_POST['itemCode'])) {
    $vItemCode = array_merge($_POST['itemCode'], $_POST['vItemCode']);
} else {
    if (is_array($_POST['itemCode'])) {
        $vItemCode = $_POST['itemCode'];
    } else {
        if (is_array($_POST['vItemCode'])) {
            $vItemCode = $_POST['vItemCode'];
        }
    }
}
// echo $view; exit;
// prints($_POST);
if (is_array($eOrderType)) {
    ### SERVER SIDE VALIDATION ####
示例#7
0
        break;
}
//$reqVal = Recompile($reqVal);
/*Prints($fileds);
Prints($itemfileds);

Prints($reqVal);
Prints($itemval);
exit;*/
$scs = 'n';
// Prints($itemval);
// pr($reqVal); exit;
if (count($reqVal) > 0) {
    if (!isset($poLineObj)) {
        include_once SITE_CLASS_APPLICATION . "user/class.PurchaseOrderLine.php";
        $poLineObj = new PurchaseOrderLine();
    }
    if (!isset($orgUsrObj)) {
        require_once SITE_CLASS_APPLICATION . "user/class.OrganizationUser.php";
        $orgUsrObj = new OrganizationUser();
    }
    if (!isset($orgObj)) {
        include_once SITE_CLASS_APPLICATION . "organization/class.Organization.php";
        $orgObj = new Organization();
    }
    if (!isset($statusmasterObj)) {
        include_once SITE_CLASS_APPLICATION . "class.StatusMaster.php";
        $statusmasterObj = new StatusMaster();
    }
    $TagArr = array('Buyer Company ID' => 'iBuyerOrganizationID', 'Buyer Company Name' => 'vBuyerCompanyName', 'Buyer Code' => 'vBuyerCode', 'Suplier Company ID' => 'iSupplierOrganizationID', 'Suplier Company Name' => 'vSupplierName', 'Supplier Contact Party' => 'vSupplierContactParty', 'Po Buyer Code' => 'vPoBuyerCode', 'PO Code' => 'vPOCode', 'Order date' => 'dOrderDate', 'Order Description' => 'tOrderDescription', 'Opening Unit' => 'iOpeningUnit', 'Supplier Order Num' => 'vSupplierOrderNum', 'Carrier' => 'tCarrier', 'Line Item Tax' => 'eLineItemTax', 'VAT' => 'fVAT', 'Other tax 1' => 'fOther_tax_1', 'ShipToParty' => 'vShipToParty', 'Ship To Address Line1' => 'vShipToAddressLine1', 'Ship To Address Line 2' => 'vShipToAddressLine2', 'Ship To City' => 'vShipToCity', 'Ship To Country' => 'vShipToCountry', 'Ship To State' => 'vShipToState', 'Ship To Zip Code' => 'vShipToZipCode', 'Ship To Contact Party' => 'vShipToContactParty', 'Ship To Contact Telephone' => 'vShipToContactTelephone', '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', 'PO Total' => 'fPOTotal', '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');
    $pref_ary = array('tSourcingDocument', 'tGlobalAgreement', 'tPaymentTerms', 'tFOB', 'tDeliveryTerms', 'tShippingControl', 'tConditionsForPayment', 'tPenalties', 'tSpecialInstruction', 'tNote');
示例#8
0
}
if ($msg == 'ras') {
    $msg = $smarty->get_template_vars('MSG_ADD_SUCC');
} elseif ($msg == 'raserr') {
    $msg = $smarty->get_template_vars('MSG_ADD_ERR');
} elseif ($msg == 'rus') {
    $msg = $smarty->get_template_vars('MSG_UPDATE_SUCC');
} elseif ($msg == 'ruserr') {
    $msg = $smarty->get_template_vars('MSG_UPDATE_ERR');
} else {
    $msg = '';
}
$iPurchaseOrderID = $_GET['id'];
if (!isset($poLineObj)) {
    include_once SITE_CLASS_APPLICATION . "user/class.PurchaseOrderLine.php";
    $poLineObj = new PurchaseOrderLine();
}
if (!isset($pohObj)) {
    include_once SITE_CLASS_APPLICATION . "user/class.PurchaseOrderHeading.php";
    $pohObj = new PurchaseOrderHeading();
}
if (trim($iPurchaseOrderID) != '' && is_numeric($iPurchaseOrderID)) {
    $view = 'edit';
    $where = " AND iPurchaseOrderID={$iPurchaseOrderID}";
    $poData = $poLineObj->getDetails('*', $where);
    //prints($poData);exit;
    $podtls = $pohObj->select($iPurchaseOrderID);
    $isdtls = $statusmasterObj->getDetails('*', " AND eFor='PO' AND vStatus_en='Issued' ");
    $isdtls = $isdtls[0]['iStatusID'];
    if ($uorg_type == 'Buyer2') {
        $b2us = $pohObj->getPurchaseOrderRfq2Buyer2OrgIds($iPurchaseOrderID);
示例#9
0
 public function generatePurchaseOrder($supplierid, $date, $items)
 {
     $supplier = Supplier::GetSupplier($supplierid);
     $order = PurchaseOrder::CreateOrder($supplier, $date);
     foreach ($items as $item) {
         $ql = PurchaseOrderLine::Create($order->id, $item['item'], $item['qty'], $item['price']);
         $order->addToOrder($ql);
     }
     $voucher = $order->generate();
     if ($voucher) {
         echo json_encode($voucher);
     } else {
         echo 0;
     }
 }