code merged upload option in spl po

This commit is contained in:
venbatechnologies@gmail.com 2018-06-22 17:03:51 +05:30
parent 34cbd1536c
commit 291b612779
2 changed files with 239 additions and 318 deletions

View File

@ -42,20 +42,14 @@ class emergencypurchaseorder extends BaseController
$data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq(); $data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq();
$data['stList'] = $this->purchaseorder_model->getStatusListforAllReq(); $data['stList'] = $this->purchaseorder_model->getStatusListforAllReq();
$data['ReqList'] = $this->purchaseorder_model->getRequistionListbySearch(); $data['ReqList'] = $this->purchaseorder_model->getRequistionListbySearch();
$this->global['pageTitle'] = $this->CompanyName.' : Create Purchase Order from Requistion'; $this->global['pageTitle'] = $this->CompanyName.' : Create PO from Requisition List';
$this->loadViews("createPOfromRequistion", $this->global, $data,Null); $this->loadViews("createPOfromRequistion", $this->global, $data,Null);
} }
/**
* To create new emergency po
*/
function CreateEmergencyPO() function CreateEmergencyPO()
{ {
$RequestedBy = $this->session->userdata ('EmpID'); $RequestedBy = $this->session->userdata ('EmpID');
$this->global['pageTitle'] = $this->CompanyName.' : Create Emergency Purchase Order';
//$this->global['pageTitle'] = 'Resico : Create Emergency Purchase Order';
$this->global['pageTitle'] = $this->CompanyName.' : Emergency Purchase Order';
$data['RequestType'] = $this->requistion_model->getConfigValue('C004'); $data['RequestType'] = $this->requistion_model->getConfigValue('C004');
$data['Suplist'] = $this->purchaseorder_model->getSupplierName(); $data['Suplist'] = $this->purchaseorder_model->getSupplierName();
$data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR'); $data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR');
@ -69,24 +63,23 @@ class emergencypurchaseorder extends BaseController
$data['ServiceOption'] = $this->requistion_model->getConfigValue('C022'); $data['ServiceOption'] = $this->requistion_model->getConfigValue('C022');
$data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026');
$this->loadViews("alterpurchaseorder", $this->global, $data, Null); $this->loadViews("alterpurchaseorder", $this->global, $data, Null);
} }
/** /**
* For get all material code using request type * To used for get all material code using request type
*/ */
function getMaterialCode(){ function getMaterialCode(){
$reqType = $this->input->post('input'); $reqType = $this->input->post('input');
$materialList = $this->requistion_model->GetMaterialCode($reqType); $materialList = $this->requistion_model->GetMaterialCode($reqType);
echo json_encode($materialList); echo json_encode($materialList);
} }
/** /*This function is used for get cost center list using department code*/
* For get cost center list using department code
*/
function getCostCenterName(){ function getCostCenterName(){
$CostList=''; $CostList='';
$DeptCode = $this->input->post('id'); $DeptCode = $this->input->post('id');
@ -95,9 +88,6 @@ class emergencypurchaseorder extends BaseController
} }
/**
* To add file for inward po
*/
function addfile($pathname) function addfile($pathname)
{ {
@ -113,7 +103,6 @@ class emergencypurchaseorder extends BaseController
$this->upload->initialize($config); $this->upload->initialize($config);
if($this->upload->do_upload($pathname)) if($this->upload->do_upload($pathname))
{ {
// echo "uploadif";
$uploadData = $this->upload->data(); $uploadData = $this->upload->data();
$picture = $uploadData['file_name']; $picture = $uploadData['file_name'];
} }
@ -132,41 +121,6 @@ class emergencypurchaseorder extends BaseController
} }
/*----------------------------------special po file upload service----------------------------------*/
function add($pathname)
{
$picture = '';
if(!empty($_FILES[$pathname]['name']))
{
$config['upload_path'] = 'uploads/BillFiles/';
$config['allowed_types'] = '*';
$config['file_name'] = str_replace(" ","",$_FILES[$pathname]['name']);
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload($pathname))
{
$uploadData = $this->upload->data();
$picture = $uploadData['file_name'];
}
else
{
$error = array('error' => $this->upload->display_errors());
$picture = '';
}
}
else
{
$picture = '';
}
return $picture ;
}
/**
* To Create Service Purchase Order
*/
function addNewServicePurchaseOrder() function addNewServicePurchaseOrder()
{ {
$txtRowCount=$this->input->post('txtRowCount'); $txtRowCount=$this->input->post('txtRowCount');
@ -330,14 +284,12 @@ class emergencypurchaseorder extends BaseController
{ {
if($value == $files) if($value == $files)
{ {
$fcount++; $fcount++;
} }
} }
if($fcount == 0) if($fcount == 0)
{ {
$Picture = $this->add($pathname); $Picture = $this->addfile($pathname);
$arr[] = array($Picture); $arr[] = array($Picture);
} }
@ -378,9 +330,6 @@ class emergencypurchaseorder extends BaseController
} }
} }
/**
* To Create Revenue Emergency Purchase Order
**/
function addNewRevenuePurchaseOrder() function addNewRevenuePurchaseOrder()
{ {
$txtspl=$this->input->post('txtSpecial'); $txtspl=$this->input->post('txtSpecial');
@ -406,7 +355,6 @@ class emergencypurchaseorder extends BaseController
$fincap=$this->input->post('emergfincap'); $fincap=$this->input->post('emergfincap');
$revenuetype=$this->input->post('PoTypeOptions'); $revenuetype=$this->input->post('PoTypeOptions');
$insurancestatus=$this->input->post('insuranceStatus'); $insurancestatus=$this->input->post('insuranceStatus');
if($insurancestatus == 1){ if($insurancestatus == 1){
$insuranceno=$this->input->post('insuranceNo'); $insuranceno=$this->input->post('insuranceNo');
}else{ }else{
@ -429,7 +377,7 @@ class emergencypurchaseorder extends BaseController
$POStatus=SPECIAL_PO; $POStatus=SPECIAL_PO;
} }
$RequestedBy = $this->input->post('drpDepartment'); $RequestedBy = $this->input->post('drpDepartment');
$CreateBy = $this->session->userdata ( 'userId' ); $CreateBy = $this->session->userdata ( 'userId' );
$RowCount=$this->input->post('txtRowCount1'); $RowCount=$this->input->post('txtRowCount1');
$BudgetType = $this->input->post('Budget'); $BudgetType = $this->input->post('Budget');
@ -452,7 +400,6 @@ class emergencypurchaseorder extends BaseController
{ {
$Qualitycheck=1; $Qualitycheck=1;
} }
//add requistion
$Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy); $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy);
$Req = $this->requistion_model->addRequistion($Request); $Req = $this->requistion_model->addRequistion($Request);
@ -656,8 +603,6 @@ class emergencypurchaseorder extends BaseController
$igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt); $igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt);
$igrD = $this->inwardgateregister_model->addigrD($igrDetails); $igrD = $this->inwardgateregister_model->addigrD($igrDetails);
$IGRItemNo = ''; $IGRItemNo = '';
foreach($igrD as $value) foreach($igrD as $value)
{ {
@ -666,11 +611,6 @@ class emergencypurchaseorder extends BaseController
} }
$MaterialstockHistoryadd= array('Ref_No'=>$IGRItemNo,'MaterialCode'=>$MaterialCode,'Transaction_type'=>'Add','Ref_Type'=>'IGR','SupplierID'=>$SupplierID,'Quantity'=>$QuantityAsPerInvoice,'ItemValue'=>$itemRate,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt);
$this->inwardgateregister_model->addMaterialStockHistory($MaterialstockHistoryadd);
$Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode);
$ReceivedQuantity = 0.00; $ReceivedQuantity = 0.00;
if(count($Recqty)>0) if(count($Recqty)>0)
@ -779,20 +719,13 @@ $prefile =array();
$returns = $this->paginationCompress ( "purchaseorderListing/", $count, 5 ); $returns = $this->paginationCompress ( "purchaseorderListing/", $count, 5 );
$this->purchaseorder_model->UpdateRequistionStatus(); $this->purchaseorder_model->UpdateRequistionStatus();
$data['POData'] = $this->purchaseorder_model->purchaseorderListing(); $data['POData'] = $this->purchaseorder_model->purchaseorderListing();
//$this->global['pageTitle'] = 'Resico : Purchase Orders'; $this->global['pageTitle'] = $this->CompanyName.' : Purchase Orders';
$this->global['pageTitle'] = $this->CompanyName.' : Purchase Orders Details';
$this->loadViews("POlist", $this->global, $data, NULL); $this->loadViews("POlist", $this->global, $data, NULL);
} }
/**
*Validation for dropdown
*/
function Req_validate($selectValue) function Req_validate($selectValue)
{ {
if(strlen($selectValue) == 0) if(strlen($selectValue) == 0)
{ {
$this->form_validation->set_message('Req_validate', 'Please Select Requisition Number to Create PO.'); $this->form_validation->set_message('Req_validate', 'Please Select Requisition Number to Create PO.');
@ -823,7 +756,6 @@ $prefile =array();
else else
{ {
//$this->global['pageTitle'] = 'Resico : Purchase order form';
$this->global['pageTitle'] = $this->CompanyName.' : Purchase order form'; $this->global['pageTitle'] = $this->CompanyName.' : Purchase order form';
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006'); $data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
$data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018'); $data['FreightType'] = $this->purchaseorder_model->getConfigValue('C018');
@ -845,13 +777,12 @@ $prefile =array();
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$Year = $dt->format('Y'); $Year = $dt->format('Y');
$data['CostList'] = $this->purchaseorder_model->getCostCenterbyRequist('',$Year,$ReqType); $data['CostList'] = $this->purchaseorder_model->getCostCenterbyRequist('',$Year,$ReqType);
$data['MaterialList'] = $result; $data['MaterialList'] = $result; //$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray);
$data['RequistionDetails'] = $this->purchaseorder_model->getRequistDetails($ReqArray); $data['RequistionDetails'] = $this->purchaseorder_model->getRequistDetails($ReqArray);
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation();
$data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate(); $data['MaxPODate'] = $this->purchaseorder_model->getLastCreatedPODate();
$ViewName = ''; $ViewName = '';
if($ReqType == REVENUE) if($ReqType == REVENUE)
{ {
$ViewName = 'Purchaseorder'; $ViewName = 'Purchaseorder';
@ -860,7 +791,6 @@ $prefile =array();
{ {
$ViewName = 'servicePurchaseorder'; $ViewName = 'servicePurchaseorder';
} }
$this->loadViews($ViewName, $this->global,$data, NULL); $this->loadViews($ViewName, $this->global,$data, NULL);
} }
} }
@ -881,9 +811,7 @@ $prefile =array();
} }
} }
/**
* To View/Update Emergency Purchase Order
**/
function EditPurchaseOrder() function EditPurchaseOrder()
{ {
$PONO = $_GET['PONO']; $PONO = $_GET['PONO'];
@ -920,9 +848,8 @@ $prefile =array();
} }
} }
/**
* To get the Material value based on the MaterialCode // To get the Material value based on the MaterialCode
**/
function getDetailsforReq() function getDetailsforReq()
{ {
$SearchFilter= $this->input->post('id'); $SearchFilter= $this->input->post('id');
@ -961,9 +888,7 @@ $prefile =array();
die(json_encode(array('MatDetail' =>$HTML1,'Cost'=> $HTML))); die(json_encode(array('MatDetail' =>$HTML1,'Cost'=> $HTML)));
} }
/* This method to get the status based on the Department selection in th
/**
* This method to get the status based on the Department selection in th
*/ */
function getStatusByDepartment() function getStatusByDepartment()
{ {
@ -984,9 +909,7 @@ $prefile =array();
die(json_encode(array('depStaus' => $HTML))); die(json_encode(array('depStaus' => $HTML)));
} }
/** // To get the available Budget Amount
* To get the available Budget Amount
**/
function AvilBudgetAmount() function AvilBudgetAmount()
{ {
$SearchFilter= $this->input->post('id'); $SearchFilter= $this->input->post('id');
@ -1008,25 +931,23 @@ $prefile =array();
} }
/**
* To Convert the dateformat (date with time) and stored into DB
*/
function getDateformat($Val) function getDateformat($Val)
{ {
$date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata'));
$retDate = $date->format('Y-m-d H:i:s'); $retDate = $date->format('Y-m-d H:i:s');
return $retDate; return $retDate;
} }
/* Method to get the Requistion list based on the search filter*/
/**
* Method to get the Requistion list based on the search filter
**/
function SearchListofRequistion() function SearchListofRequistion()
{ {
$SearchFilter= $this->input->post('id'); $SearchFilter= $this->input->post('id');
$DEPCode = $SearchFilter[0]; $DEPCode = $SearchFilter[0];
$Status = $SearchFilter[1]; $Status = $SearchFilter[1];
$rng = $SearchFilter[2]; $rng = $SearchFilter[2];
$FromDate =''; $FromDate ='';
$ToDate = ''; $ToDate = '';
@ -1039,8 +960,10 @@ $prefile =array();
$FromDate = $this->getDateformat($FDate); $FromDate = $this->getDateformat($FDate);
$ToDate = $this->getDateformat($TDate); $ToDate = $this->getDateformat($TDate);
} }
$result = $this->purchaseorder_model->getRequistionListbySearch($DEPCode,$Status,$FromDate,$ToDate); $result = $this->purchaseorder_model->getRequistionListbySearch($DEPCode,$Status,$FromDate,$ToDate);
$HTML=""; $HTML="";
for ($i = 0; $i < count($result); $i++) for ($i = 0; $i < count($result); $i++)
{ {
@ -1068,9 +991,6 @@ $prefile =array();
} }
/**
* To View the request details
**/
function ListPORequistion() function ListPORequistion()
{ {
$ReqNo= $this->input->post('id'); $ReqNo= $this->input->post('id');
@ -1110,9 +1030,7 @@ $prefile =array();
die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter))); die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter)));
} }
/**
* To Create Revenue Purchase Order
**/
function addNewPurchaseOrder() function addNewPurchaseOrder()
{ {
$POdt =$this->input->post('PODate'); $POdt =$this->input->post('PODate');
@ -1224,6 +1142,7 @@ $prefile =array();
echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ;
} }
/** /**
* This used to Edit the Revenue Purchase Order * This used to Edit the Revenue Purchase Order
**/ **/
@ -1236,7 +1155,6 @@ $prefile =array();
$newsup=$this->input->post('newsup'); $newsup=$this->input->post('newsup');
$newSupId = split("[ - ]+", $newsup); $newSupId = split("[ - ]+", $newsup);
$b4supplier=$this->input->post('b4supplier'); $b4supplier=$this->input->post('b4supplier');
$b4date=$this->input->post('b4podate'); $b4date=$this->input->post('b4podate');
$b4podate = $this->getDateformat($b4date); $b4podate = $this->getDateformat($b4date);
@ -1292,8 +1210,10 @@ $prefile =array();
$Quantity = $this->input->post('quantity'.$i); $Quantity = $this->input->post('quantity'.$i);
$Reqnumber = $this->input->post('Reqnumber'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i);
$itemRate = $this->input->post('itemRate'.$i); $itemRate = $this->input->post('itemRate'.$i);
$b4qty=$this->input->post('b4qty'.$i); $b4qty=$this->input->post('b4qty'.$i);
$b4rate=$this->input->post('b4rate'.$i); $b4rate=$this->input->post('b4rate'.$i);
$DiscountType = $this->input->post('DisType'.$i); $DiscountType = $this->input->post('DisType'.$i);
$DiscountValue = $this->input->post('DisVal'.$i); $DiscountValue = $this->input->post('DisVal'.$i);
$AfterDiscount = $this->input->post('AfterDisVal'.$i); $AfterDiscount = $this->input->post('AfterDisVal'.$i);
@ -1336,7 +1256,6 @@ $prefile =array();
{ {
$logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed'); $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed');
$this->purchaseorder_model->insertlogpo($logpo); $this->purchaseorder_model->insertlogpo($logpo);
} }
@ -1396,12 +1315,12 @@ $prefile =array();
echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ;
} }
/** /**
* To load pagenotfound view * To load pagenotfound view
*/ */
function pageNotFound() function pageNotFound()
{ {
//$this->global['pageTitle'] = 'Resico : 404 - Page Not Found';
$this->global['pageTitle'] = $this->CompanyName.': 404 - Page Not Found'; $this->global['pageTitle'] = $this->CompanyName.': 404 - Page Not Found';
$this->loadViews("404", $this->global, NULL, NULL); $this->loadViews("404", $this->global, NULL, NULL);
} }
@ -1444,6 +1363,7 @@ $prefile =array();
public function servicepoprint($PONO) public function servicepoprint($PONO)
{ {
// $this->load->view('includes/pdfheader');
// Load the pdf page with multiviews // Load the pdf page with multiviews
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation();

View File

@ -5388,6 +5388,7 @@ var spclins=$.trim(tinymce.get('edittxtInstruction').getContent());
function populateValueMainFormForEditImportTax() function populateValueMainFormForEditImportTax()
{ {
var rows =document.getElementById('ImportTax').rows.length; var rows =document.getElementById('ImportTax').rows.length;
var editrow = parseFloat(rows)-1;
var TotalLanding=0; var TotalLanding=0;
var TotalCustom=0; var TotalCustom=0;
@ -5460,7 +5461,7 @@ TotalIgst=parseFloat(TotalIgst)+parseFloat(Igst);
} }
}while (i < rows); }while (i < editrow);
$('#txttotallanding').val(parseFloat(TotalLanding).toFixed(2)); $('#txttotallanding').val(parseFloat(TotalLanding).toFixed(2));