<?php
include($_SERVER['DOCUMENT_ROOT'] .'/script/HeaderInc.php');
if('XMLHttpRequest' == $_SERVER['HTTP_X_REQUESTED_WITH'] && true === isset($_SESSION['SessionAuth']['id']) && 0 < $_SESSION['SessionAuth']['id']) {
  if(true === isset($_GET['purchase_id']) && '' != $_GET['purchase_id']){
    $ObjPurchaseMod = new PurchaseMod($MS_SP);
    $ArrPurchase = $ObjPurchaseMod->GetFromDb('SqlAll', 'GetRow', "p.purchase_id = '". $_GET['purchase_id'] ."'");
    $smarty->assign('ArrPurchase', $ArrPurchase);
  }
  $ObjPurchaseStatusMod = new PurchaseStatusMod($MS_SP);
  $ArrPurchaseStatus = $ObjPurchaseStatusMod->GetFromDb('SqlAll', 'GetAll', '', 'a.purchasestatus_order');
  $smarty->assign('ArrPurchaseStatus', $ArrPurchaseStatus);
  $VarReturn = $smarty->fetch('Purchase/Form.tpl');
}
else{
  $VarReturn = $MS_SP->Sp_LangMessage['error']['ErrFuncAccessDenied'];
}
echo $VarReturn;
include($_SERVER['DOCUMENT_ROOT'] .'/script/FooterInc.php');
?>