fixed file upload in purchase modue

This commit is contained in:
vadivel J 2024-09-30 16:38:41 +05:30
parent 5804e41a65
commit d8ceb86d24
12 changed files with 140 additions and 48 deletions

View File

@ -139,6 +139,8 @@ class Purchaseorder extends BaseController
*/
public function CreatePurchaseOrder()
{
$validation = \Config\Services::validation();
$validation->setRule('txtReqNo', 'Requisition Number', ['Req_validate[txtReqNo]'], ['Req_validate' => 'Please Select Requisition Number to Create PO.']);
@ -253,11 +255,13 @@ class Purchaseorder extends BaseController
$ViewName = 'servicePurchaseorder';
} else if ($ReqType == IMPORT) {
$data['staticspecialinstruction'] = $this->purchaseorder_model->getConfigValue('C027');
$ViewName = 'importpo';
} else if ($ReqType == CAPITAL) {
$data['staticspecialinstruction'] = $this->purchaseorder_model->getConfigValue('C027');
$CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode, $FYdt, $ReqType);
@ -536,6 +540,7 @@ class Purchaseorder extends BaseController
{
view("capitalpopdf");
}
//To View/Update Purchase Order
function EditPurchaseOrder()
@ -640,6 +645,7 @@ class Purchaseorder extends BaseController
// print_r($data);die;
$this->global['pageTitle'] = 'Edit Service Purchase order form';
$this->loadViews("EditservicePurchaseorder", $this->global, $data, NULL);
} else if ($ReqType == REVENUE) {
$data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO);
@ -650,6 +656,7 @@ class Purchaseorder extends BaseController
$data['WorkStatus'] = $this->purchaseorder_model->getStatus(7);
$this->global['pageTitle'] = 'Edit Revenue Purchase order form';
$this->loadViews("editRevenuepurchaseorder", $this->global, $data, NULL);
} else if ($ReqType == IMPORT) {
$AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode, $FYdt, $ReqType);
@ -661,10 +668,12 @@ class Purchaseorder extends BaseController
$data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO);
// print_r($data['POItem']);
$data['Currency'] = $this->purchaseorder_model->GetCurrencytype();
foreach ($data['POMaster'] as $CUR) {
//print_r($CUR->CurrencyType);
$Currency = $CUR->CurrencyType;
}
}
// $data[$Rate->ExchangeRate]=$Rate->ExchangeRate;
$data['CurrencyDetail'] = $this->purchaseorder_model->GetCurrencyDetail($Currency);
$data['PaymentTerms'] = $this->purchaseorder_model->GetPaymentTerms($PONO);
@ -682,7 +691,10 @@ class Purchaseorder extends BaseController
$data['unicode'] = $unicode;
$data['currencycode'] = $currencycode;
$this->global['pageTitle'] = 'Edit Import Purchase order form';
$this->loadViews("editimportpo", $this->global, $data, NULL);
} else if ($ReqType == CAPITAL) {
$CapitalRange = $this->request->getVar('CapitalRange');
@ -690,8 +702,6 @@ class Purchaseorder extends BaseController
if (count($CapitalAvlBudget) > 0) {
$data['AvlCapitalBudAmt'] = $CapitalAvlBudget[0]['BudgetAmount'] - $CapitalAvlBudget[0]['Totalvalue'];
}
@ -1068,6 +1078,7 @@ class Purchaseorder extends BaseController
function addNewPurchaseOrder()
{
try {
// Extract POST data
$POdt = $this->request->getPost('PODate');
$PODate = get_date_time_format($POdt);
@ -1096,7 +1107,7 @@ class Purchaseorder extends BaseController
$TotalOrderValueSummary = $this->request->getPost('txtTotalOrderValueSummary');
$POStatus = $this->request->getPost('txtStatus');
$CreateBy = $this->session->get('userId');
$RowCount = $this->request->getPost('txtRowCount');
$RowCount = $this->request->getPost('txtRowCount');
$DeletedRow = $this->request->getPost('txtDeletedRow');
$comma_separated = ($DeletedRow !== null && is_string($DeletedRow)) ? explode(':', $DeletedRow) : [];
$createddt = get_current_date_time();
@ -1118,7 +1129,11 @@ class Purchaseorder extends BaseController
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename);
$requestfilename = "";
//$requestfilename = "";
//the above line is commented due to the fact that same file can exist in the database
//for different po
} else {
$file->move($path, $requestfilename);
}
@ -1302,6 +1317,8 @@ class Purchaseorder extends BaseController
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename);
$POList['POFile'] = $requestfilename;
} else {
$file->move($path, $requestfilename);
$POList['POFile'] = $requestfilename;
@ -1991,7 +2008,11 @@ class Purchaseorder extends BaseController
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename);
$requestfilename = "";
//$requestfilename = "";
//the above line is commented due to the fact that same file can exist in the database
//for different po
} else {
$file->move($path, $requestfilename);
}
@ -2216,6 +2237,7 @@ class Purchaseorder extends BaseController
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename);
$POList['POFile'] = $requestfilename;
} else {
$file->move($path, $requestfilename);
$POList['POFile'] = $requestfilename;
@ -2655,7 +2677,11 @@ class Purchaseorder extends BaseController
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename);
$requestfilename = "";
//$requestfilename = "";
//the above line is commented due to the fact that same file can exist in the database
//for different po
} else {
$file->move($path, $requestfilename);
}
@ -2938,7 +2964,8 @@ class Purchaseorder extends BaseController
mkdir($path, 0777, true);
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename);
log_message('error', 'File already exists in the database' . $requestfilename);
$POList['POFile'] = $requestfilename;
} else {
$file->move($path, $requestfilename);
$POList['POFile'] = $requestfilename;

View File

@ -246,7 +246,11 @@ class Servicepurchaseorder extends BaseController
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database' . $requestfilename);
$requestfilename = "";
//$requestfilename = "";
//the above line is commented due to the fact that same file can exist in the database
//for different po
} else {
$file->move($path, $requestfilename);
}
@ -422,6 +426,7 @@ class Servicepurchaseorder extends BaseController
}
if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) {
log_message('error', 'File already exists in the database: ' . $requestfilename);
$POList['POFile'] = $requestfilename;
} else {
$file->move($path, $requestfilename);
$POList['POFile'] = $requestfilename;

View File

@ -145,9 +145,7 @@ Where IGRM.PONO = ? ';
return $query->getResult();
}
function fileupload($myfile)
function fileupload($myfile)
{
//print_r($myfile);die;
@ -986,8 +984,14 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
function GetServicePurchaseOrder($PONO = '')
{
$builder = $this->db->table('t_purchaseorder_master POMast')->distinct()
->select('ReqNo,POMast.PONO,POMast.PaymentTerms,POMast.PaymentOtherDescription,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,supp.MSME,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,POMast.PaymentTerms,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,POMast.ServiceWorkStatus,POMast.*,POMast.TotalOrderValue,POMast.BudgetType,IGR.IGRNO')
->select('ReqNo,POMast.PONO,POMast.PaymentTerms,POMast.PaymentOtherDescription,
ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,supp.MSME,
PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,
POMast.PaymentTerms,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,
POMast.ServiceWorkStatus,POMast.*,POMast.TotalOrderValue,POMast.BudgetType,IGR.IGRNO')
->join('t_supplierdetailsn supp', 'supp.SupplierID = POMast.SupplierID')
->join('t_status Stat', 'Stat.StatusCode = POMast.Status')
->join('t_purchaseorder_lineitem LineItem', 'POMast.PONO = LineItem.PONO')

View File

@ -1312,7 +1312,7 @@ if (!empty($getlogpodtl)) {
<br>
<div class="form-row">
<div class="form-row ">
<div class="form-group col-md-12" id="splpodiv">
<label>Special po Table List</label>
<table id="table2" class="table table-striped table-hover mb-0" style="font-size:12px;">
@ -1447,18 +1447,28 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div class="form-group col-md-12 px-4">
<div align="left">
<label>Select File</label>
<div class="form-group col-md-12 px-4" align="left">
<label>Select Purchase Order File</label>
<br>
<input type="file" name="POFile" id="POFile">
<?php if ($PrePOFile) { ?>
</div>
<div class="form-group col-md-12 px-4" align="left">
<?php if ($PrePOFile) { ?>
<label><a title="previously uploaded PO File" href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>previously uploaded - </span><small><?= $PrePOFile; ?></small></a></label>
<?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" />
<br>
</div>
</div>
<div class="form-group col-md-12 px-4">
<div align="right"><br />
<div>

View File

@ -842,7 +842,7 @@ if (!empty($INRSYMBOL)) {
<label>Select Purchase Order File</label><br>
<input type="file" name="POFile" id="POFile"><br>
</div>
</div>
</div>
<div align="right" style="padding:1% 0%;">
@ -5106,14 +5106,6 @@ if (!empty($INRSYMBOL)) {
$('#txtTotalFreight').val(parseFloat(TotFreight).toFixed(2));
}
$("#CurrencySymbol").val('');
var DisplayCurrencySymbol = '';
$('#currencytype').change(function() {

View File

@ -1493,12 +1493,27 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div align="right" style="padding:3% 2%;">
<div>
<input type="file" name="POFile" id="POFile">
<?php if ($PrePOFile) { ?>
<br>
<div class="form-row" align="left">
<div class="form-group col-md-12">
<label> Select Purchase Order File </label>
<input type="file" name="POFile" id="POFile">
</div>
</div>
<div class="form-row" align="left">
<div class="form-group col-md-12">
<?php if ($PrePOFile) { ?>
<label><a title="previously uploaded PO File" href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>previously uploaded - </span><small><?= $PrePOFile; ?></small></a></label>
<?php } ?>
</div>
</div>
<div align="right" style="padding:3% 2%;">
<div>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br>
</div>
<input type="hidden" name="txtPoRange" id="txtPoRange" />

View File

@ -2625,15 +2625,35 @@ if (!empty($getlogpodtl)) {
</div>
<?php } else {
} ?>
<div class="form-row">
<div class="form-group col-md-12">
<label>Select Purchase Order File</label><br>
<input type="file" name="POFile" id="POFile">
</div>
</div>
<?php if ($PrePOFile) { ?>
<div class="form-row">
<div class="form-group col-md-12" align="left"><br />
<label><a title="previously uploaded PO File"
href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>">
<span>previously uploaded purchase order file- </span>
<small><?= $PrePOFile; ?></small></a></label>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br>
</div>
</div>
<?php } ?>
<div class="form-row">
<div class="form-group col-md-12" align="left"><br />
<div>
<label>Select Purchase Order File</label><br>
<input type="file" name="POFile" id="POFile">
<?php if ($PrePOFile) { ?>
<label><a title="previously uploaded PO File" href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>previously uploaded - </span><small><?= $PrePOFile; ?></small></a></label>
<?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br>
</div>
<input type="hidden" name="txtPoRange" id="txtPoRange" />
<input type="hidden" name="isEdit" id="isEdit" value="0" />
@ -2664,6 +2684,12 @@ if (!empty($getlogpodtl)) {
</div><br />
</div>
<div class="form-row">
<div class="form-group col-md-12">

View File

@ -153,7 +153,6 @@ if (!empty($POMaster)) {
$SupplierRef = $Req->Supplier_Reference;
$SupOfferno = $Req->Supplier_Offer_No;
$Otherref = $Req->Other_Reference;
$Insurance = $Req->InsuranceStatus;
$InsuranceNumber = $Req->InsuranceNumber;
$Importoption = $Req->POSubType;
@ -1166,16 +1165,25 @@ if (!empty($getlogpodtl)) {
<div class="form-row px-4">
<div class="form-group col-md-3" align="left">
<label>Select Purchase Order File</label>
<input type="file" class="" name="POFile" id="POFile">
<?php if ($PrePOFile) { ?>
<label><a title="previously uploaded PO File" href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>previously uploaded - </span><small><?= $PrePOFile; ?></small></a></label>
<?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" />
</div>
<div class="form-group col-md-3" align="left">
<label>Select Purchase Order File</label>
<input type="file" class="" name="POFile" id="POFile">
</div>
</div>
<div class="form-row px-4">
<div class="form-group col-md-3" align="left">
<div>
<?php if ($PrePOFile) { ?>
<label><a title="previously uploaded PO File" href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>Previously Uploaded Purchase Order File- </span><small><?= $PrePOFile; ?></small></a></label>
<?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" />
</div>
</div>
</div>
<div class="form-row px-4">

View File

@ -3878,6 +3878,7 @@ if (!empty($INRSYMBOL)) {
var formData = new FormData($('.CreatePO')[0]);
$.ajax({
type: "POST",

View File

@ -2296,6 +2296,10 @@ if (!empty($INRSYMBOL)) {
} else {
var formData = new FormData($('.ServicePO')[0]);
console.log("inside add service purchase order view page");
console.log(formData);
$.ajax({
// data: $('.ServicePO').serialize(),
type: "POST",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB