FIX_IGR file Uploads
This commit is contained in:
parent
2e5af50997
commit
85a32a3879
@ -322,22 +322,47 @@ class Inwardgateregister extends BaseController
|
|||||||
$createddt = get_current_date_time();
|
$createddt = get_current_date_time();
|
||||||
//$IGRStatus = IGR_CREATED;//old
|
//$IGRStatus = IGR_CREATED;//old
|
||||||
$IGRStatus = (int)$this->request->getPost('hideIGRStatus') == 1 ? IGR_CREATED : IGR_DRAFT;
|
$IGRStatus = (int)$this->request->getPost('hideIGRStatus') == 1 ? IGR_CREATED : IGR_DRAFT;
|
||||||
$document = null;
|
|
||||||
$igr = array(); // For IGR Master
|
$igr = array(); // For IGR Master
|
||||||
$paymentstatus = NO_PAIDIGR;
|
$paymentstatus = NO_PAIDIGR;
|
||||||
$constant = $this->request->getPost('hideconstants');
|
|
||||||
$arr = []; // For File to Save
|
|
||||||
$prefile = array();
|
|
||||||
$fileupdated_count = 0;
|
$fileupdated_count = 0;
|
||||||
$fileupdated_name = [];
|
$fileupdated_name = [];
|
||||||
|
|
||||||
|
#Step 1 File Path Creation
|
||||||
|
$path = ROOTPATH.'public/uploads/Igrfiles/';
|
||||||
|
if(!is_dir($path)) { mkdir($path, 0777, true); }
|
||||||
|
|
||||||
|
#Step 2 Master File and Its Details Gathering
|
||||||
|
$MasterFile = $this->request->getFile('MasterFile');
|
||||||
|
$requestMasterFileName = $MasterFile->getName();
|
||||||
|
|
||||||
|
if (!empty($requestMasterFileName)) {
|
||||||
|
if ($MasterFile && $MasterFile->isValid() && !$MasterFile->hasMoved()) {
|
||||||
|
if (!empty($this->inwardgateregister_model->isFileExistsInIGRmaster($requestMasterFileName))) {
|
||||||
|
log_message('error', 'File already exists in the database'.$requestMasterFileName);
|
||||||
|
$requestMasterFileName = NULL;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$MasterFile->move($path, $requestMasterFileName);
|
||||||
|
$fileupdated_count++;
|
||||||
|
$fileupdated_name[] = $requestMasterFileName;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$requestMasterFileName = NULL;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$requestMasterFileName = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Step 3 Master Details Gathering to Save In DB
|
||||||
$igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus);
|
$igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus);
|
||||||
|
$igr['MasterFile'] = $requestMasterFileName;
|
||||||
//Saving IGR details Here
|
#Step 4 Calling DB to Save IGR Master
|
||||||
$IGRNO = $this->inwardgateregister_model->addigrM($igr);
|
$IGRNO = $this->inwardgateregister_model->addigrM($igr);
|
||||||
|
// $IGRNO = "IGRNO02734";
|
||||||
if($IGRNO){
|
if($IGRNO){
|
||||||
#Step 1.1 Fetch On History
|
#Step 5 Save Master Detail On History Table
|
||||||
if($VehicleNo){
|
if($VehicleNo){
|
||||||
$igr_history = array('field' => 'VehicleNo','is_add' => 1,'new_data' => $VehicleNo,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
$igr_history = array('field' => 'VehicleNo','is_add' => 1,'new_data' => $VehicleNo,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
@ -353,73 +378,15 @@ class Inwardgateregister extends BaseController
|
|||||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
}
|
}
|
||||||
#Step 2 File Details Gathering
|
|
||||||
if($constant){
|
|
||||||
for ($i = 1; $i <= $constant; $i++) {
|
|
||||||
$pathname = 'browseFiles' . $i;
|
|
||||||
$file = $this->request->getFile($pathname);
|
|
||||||
if ($file && $file->isValid()) {
|
|
||||||
$requestfilename = $file->getName();
|
|
||||||
if (!empty($requestfilename)) {
|
|
||||||
|
|
||||||
$files = str_replace(" ", "", $_FILES[$pathname]['name']);
|
#Step 6 Updating OGR Details
|
||||||
$fcount = 0;
|
|
||||||
|
|
||||||
foreach ($prefile as $value) {
|
|
||||||
if ($value == $files) { $fcount++; }
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($fcount == 0) {
|
|
||||||
if ($file->isValid() && !$file->hasMoved()) {
|
|
||||||
$path = ROOTPATH.'public/uploads/Igrfiles/';
|
|
||||||
if(!is_dir($path)) { mkdir($path, 0777, true); }
|
|
||||||
$Picture = $file->getName();
|
|
||||||
$file->move($path,$Picture);
|
|
||||||
log_message('error', "File new" . $i . " uploaded successfully. File name: " . $requestfilename);
|
|
||||||
}
|
|
||||||
$arr[] = array($Picture);
|
|
||||||
}
|
|
||||||
|
|
||||||
$prefile[] = $files;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
log_message('error', "No file uploaded for new" . $i . " or there was an error uploading the file.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#Step 2.1 Saving File Details
|
|
||||||
if (!empty($arr)) {
|
|
||||||
foreach ($arr as $ma) {
|
|
||||||
$index = 0;
|
|
||||||
foreach ($ma as $key => $value) {
|
|
||||||
$index++;
|
|
||||||
if ($index == 1) {
|
|
||||||
$filename = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!empty($filename)) {
|
|
||||||
|
|
||||||
$myfile = array('FilePath' => $filename, 'PONO' => $PONO, 'IGRNO' => $IGRNO);
|
|
||||||
$fileupdated = $this->inwardgateregister_model->fileupload($myfile);
|
|
||||||
if ($fileupdated) {
|
|
||||||
$fileupdated_count++;
|
|
||||||
$fileupdated_name[] = $filename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Step 3 Updating OGR Details
|
|
||||||
$OGRStatus = $IGRStatus;
|
$OGRStatus = $IGRStatus;
|
||||||
$check_OGRPO = $this->inwardgateregister_model->update_OGR($PONO, $OGRStatus);
|
$check_OGRPO = $this->inwardgateregister_model->update_OGR($PONO, $OGRStatus);
|
||||||
// echo "step3";
|
|
||||||
// echo "uuu".(int)$check_OGRPO;
|
// echo "uuu".(int)$check_OGRPO;
|
||||||
$IGRItemStatus = REQITEM_NEW;
|
$IGRItemStatus = REQITEM_NEW;
|
||||||
$TotalPendingQty = '';
|
$TotalPendingQty = '';
|
||||||
$TotalPendingQty = (int)$TotalPendingQty;
|
$TotalPendingQty = (int)$TotalPendingQty;
|
||||||
// echo "step4";
|
#Step 7 To Update the Date PO MASTER , Material Master , Historydetails and IGR line Item Details Updating OGR Details
|
||||||
#Step 4 To Update the Date PO MASTER , Material Master , Historydetails and IGR line Item Details Updating OGR Details
|
|
||||||
for ($i = 1; $i <= (int)$RowCount; $i++) {
|
for ($i = 1; $i <= (int)$RowCount; $i++) {
|
||||||
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
|
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
|
||||||
$MaterialCode = $MaterialCode !== null && is_string($MaterialCode) ? trim($MaterialCode) : null;
|
$MaterialCode = $MaterialCode !== null && is_string($MaterialCode) ? trim($MaterialCode) : null;
|
||||||
@ -438,6 +405,29 @@ class Inwardgateregister extends BaseController
|
|||||||
$NetWeight= $this->request->getPost('txtNetWeight' . $i);
|
$NetWeight= $this->request->getPost('txtNetWeight' . $i);
|
||||||
// var_dump($grossWeightDate);
|
// var_dump($grossWeightDate);
|
||||||
// var_dump($tareWeightDate);
|
// var_dump($tareWeightDate);
|
||||||
|
#Step 8 Saving Weight File and Its Details Gathering
|
||||||
|
$WeightFile = $this->request->getFile('txtWeightFile' . $i);
|
||||||
|
$requestWeightFileName = $WeightFile->getName();
|
||||||
|
// echo $i.$requestWeightFileName;die;
|
||||||
|
|
||||||
|
if (!empty($requestWeightFileName)) {
|
||||||
|
if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) {
|
||||||
|
// $WeightFile->move($path, $requestWeightFileName);
|
||||||
|
if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) {
|
||||||
|
log_message('error', 'File already exists in the database'.$requestWeightFileName);
|
||||||
|
$requestWeightFileName = NULL;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$WeightFile->move($path, $requestWeightFileName);
|
||||||
|
$fileupdated_count++;
|
||||||
|
$fileupdated_name[] = $requestWeightFileName;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$requestWeightFileName = NULL;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$requestWeightFileName = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
$GrossWeightDate = !empty($grossWeightDate) && is_string($grossWeightDate) ? date('Y-m-d H:i:s', strtotime($grossWeightDate)) : null;
|
$GrossWeightDate = !empty($grossWeightDate) && is_string($grossWeightDate) ? date('Y-m-d H:i:s', strtotime($grossWeightDate)) : null;
|
||||||
$TareWeightDate = !empty($tareWeightDate) && is_string($tareWeightDate) ? date('Y-m-d H:i:s', strtotime($tareWeightDate)) : null;
|
$TareWeightDate = !empty($tareWeightDate) && is_string($tareWeightDate) ? date('Y-m-d H:i:s', strtotime($tareWeightDate)) : null;
|
||||||
@ -454,6 +444,7 @@ class Inwardgateregister extends BaseController
|
|||||||
|
|
||||||
$CreatedBy = $this->session->get('userId');
|
$CreatedBy = $this->session->get('userId');
|
||||||
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus,'GrossWeight' => (float)$GrossWeight ,'GrossWeightDate'=> $GrossWeightDate,'TareWeight' => (float)$TareWeight ,'TareWeightDate' => $TareWeightDate ,'NetWeight' => (float)$NetWeight, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
|
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus,'GrossWeight' => (float)$GrossWeight ,'GrossWeightDate'=> $GrossWeightDate,'TareWeight' => (float)$TareWeight ,'TareWeightDate' => $TareWeightDate ,'NetWeight' => (float)$NetWeight, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
|
||||||
|
$igrDetails['WeightFile'] = $requestWeightFileName;
|
||||||
log_message('error', 'SaveIGR igrDetails result : ' . json_encode($igrDetails));
|
log_message('error', 'SaveIGR igrDetails result : ' . json_encode($igrDetails));
|
||||||
|
|
||||||
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
||||||
@ -532,7 +523,7 @@ class Inwardgateregister extends BaseController
|
|||||||
|
|
||||||
$this->inwardgateregister_model->UpdatePOMaster($PONO, $CreatedBy);
|
$this->inwardgateregister_model->UpdatePOMaster($PONO, $CreatedBy);
|
||||||
|
|
||||||
#Step 6 Updating Pending Quantity IN PO Master amd Line Item Details.
|
#Step 9 Updating Pending Quantity IN PO Master amd Line Item Details.
|
||||||
if ($TotalPendingQty == 0.00) {
|
if ($TotalPendingQty == 0.00) {
|
||||||
$Newstatus = array('Status' => $IGRStatus);
|
$Newstatus = array('Status' => $IGRStatus);
|
||||||
$this->inwardgateregister_model->POLineItemsupdatestatus($PONO, $Newstatus);
|
$this->inwardgateregister_model->POLineItemsupdatestatus($PONO, $Newstatus);
|
||||||
@ -544,7 +535,7 @@ class Inwardgateregister extends BaseController
|
|||||||
$finalstatement = "Successfully Created IGR Number: $IGRNO \n";
|
$finalstatement = "Successfully Created IGR Number: $IGRNO \n";
|
||||||
if ($fileupdated_count > 0) {
|
if ($fileupdated_count > 0) {
|
||||||
$finalstatement .= "Number of files updated: $fileupdated_count \n";
|
$finalstatement .= "Number of files updated: $fileupdated_count \n";
|
||||||
$finalstatement .= "Files: \n " . implode('\n ', $fileupdated_name);
|
$finalstatement .= "Files: \n" . implode(PHP_EOL, $fileupdated_name);
|
||||||
} else {
|
} else {
|
||||||
$finalstatement .= "No files to update";
|
$finalstatement .= "No files to update";
|
||||||
}
|
}
|
||||||
@ -579,7 +570,7 @@ function viewIGRDetails()
|
|||||||
{
|
{
|
||||||
$IGRNO = $this->request->getPost('id');
|
$IGRNO = $this->request->getPost('id');
|
||||||
$igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
|
$igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
|
||||||
$billfile = $this->inwardgateregister_model->ViewIGRfile1($IGRNO);
|
$billfile = []; // $this->inwardgateregister_model->ViewIGRfile1($IGRNO);
|
||||||
$data = array_merge($igrfile, $billfile);
|
$data = array_merge($igrfile, $billfile);
|
||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
}
|
}
|
||||||
@ -609,9 +600,31 @@ function viewIGRDetails()
|
|||||||
$IGRStatus = (int)$this->request->getPost('status') == 1 ? IGR_CREATED : IGR_DRAFT;
|
$IGRStatus = (int)$this->request->getPost('status') == 1 ? IGR_CREATED : IGR_DRAFT;
|
||||||
|
|
||||||
$tableData = $this->request->getPost('tableData');
|
$tableData = $this->request->getPost('tableData');
|
||||||
|
if (is_string($tableData)) {
|
||||||
|
$tableData = json_decode($tableData, true);
|
||||||
|
}
|
||||||
$updateby = $this->session->get('userId');
|
$updateby = $this->session->get('userId');
|
||||||
|
|
||||||
|
$path = ROOTPATH.'public/uploads/Igrfiles/';
|
||||||
|
if(!is_dir($path)) { mkdir($path, 0777, true); }
|
||||||
|
|
||||||
$igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt,'VehicleNo'=>$VehicleNo,'DriverMobileNumber'=>$DriverMobileNumber,'DriverName'=>$DriverName, 'IGRStatus' => $IGRStatus,'UpdateBY' => $updateby);
|
$igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt,'VehicleNo'=>$VehicleNo,'DriverMobileNumber'=>$DriverMobileNumber,'DriverName'=>$DriverName, 'IGRStatus' => $IGRStatus,'UpdateBY' => $updateby);
|
||||||
|
|
||||||
|
$MasterFile = $this->request->getfile('MasterFile');
|
||||||
|
$requestMasterFileName = $MasterFile->getName();
|
||||||
|
|
||||||
|
if (!empty($requestMasterFileName)) {
|
||||||
|
if ($MasterFile && $MasterFile->isValid() && !$MasterFile->hasMoved()) {
|
||||||
|
if (!empty($this->inwardgateregister_model->isFileExistsInIGRmaster($requestMasterFileName))) {
|
||||||
|
log_message('error', 'File already exists in the database'.$requestMasterFileName);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$MasterFile->move($path, $requestMasterFileName);
|
||||||
|
$igrarr['MasterFile'] = $requestMasterFileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log_message('error', 'UpdateIGR igrarr: ' . json_encode($igrarr));
|
log_message('error', 'UpdateIGR igrarr: ' . json_encode($igrarr));
|
||||||
$updateigrmaster = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
|
$updateigrmaster = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
|
||||||
if(!empty($tableData )){
|
if(!empty($tableData )){
|
||||||
@ -694,6 +707,21 @@ function viewIGRDetails()
|
|||||||
'IGRItemNo' => $igrItemNo,
|
'IGRItemNo' => $igrItemNo,
|
||||||
'UpdateBY' => $updateby
|
'UpdateBY' => $updateby
|
||||||
);
|
);
|
||||||
|
// $WeightFile = $this->request->getfile('WeightFile');
|
||||||
|
// $requestWeightFileName = $WeightFile->getName();
|
||||||
|
|
||||||
|
// if (!empty($requestWeightFileName)) {
|
||||||
|
// if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) {
|
||||||
|
// if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) {
|
||||||
|
// log_message('error', 'File already exists in the database'.$requestWeightFileName);
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// $WeightFile->move($path, $requestWeightFileName);
|
||||||
|
// $igrline['WeightFile'] = $requestWeightFileName;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
$updateigrlineitem = $this->inwardgateregister_model->updateIGRLineItem($igrline, $igrItemNo);
|
$updateigrlineitem = $this->inwardgateregister_model->updateIGRLineItem($igrline, $igrItemNo);
|
||||||
log_message('error', "lineitem updated successfully: " . $updateigrlineitem);
|
log_message('error', "lineitem updated successfully: " . $updateigrlineitem);
|
||||||
log_message('error', 'UpdateIGR updateigrlineitem: ' . json_encode($igrline));
|
log_message('error', 'UpdateIGR updateigrlineitem: ' . json_encode($igrline));
|
||||||
@ -1132,6 +1160,11 @@ function updateIGRWeight(){
|
|||||||
$IGRNO = $this->request->getPost('IGR');
|
$IGRNO = $this->request->getPost('IGR');
|
||||||
$IGRItemNo = $this->request->getPost('IGRlineitem');
|
$IGRItemNo = $this->request->getPost('IGRlineitem');
|
||||||
$updateby = $this->session->get('userId');
|
$updateby = $this->session->get('userId');
|
||||||
|
$WeightFile = $this->request->getfile('WeightFile');
|
||||||
|
$requestWeightFileName = $WeightFile->getName();
|
||||||
|
$path = ROOTPATH.'public/uploads/Igrfiles/';
|
||||||
|
if(!is_dir($path)) { mkdir($path, 0777, true); }
|
||||||
|
|
||||||
if($GrossWeight){
|
if($GrossWeight){
|
||||||
$gross = $this->inwardgateregister_model->get_igr_history('GrossWeight',$IGRNO, $IGRItemNo);
|
$gross = $this->inwardgateregister_model->get_igr_history('GrossWeight',$IGRNO, $IGRItemNo);
|
||||||
if(!empty($gross)){
|
if(!empty($gross)){
|
||||||
@ -1234,6 +1267,17 @@ function updateIGRWeight(){
|
|||||||
$IGRItemNo = $this->request->getPost('IGRlineitem');
|
$IGRItemNo = $this->request->getPost('IGRlineitem');
|
||||||
$igr_lineitem = array('GrossWeight' => $GrossWeight,'GrossWeightDate' => $GrossWeightDate,'TareWeightDate' => $TareWeightDate,'TareWeight' => $TareWeight,'NetWeight' => $NetWeight,'UpdateBY' => $updateby);
|
$igr_lineitem = array('GrossWeight' => $GrossWeight,'GrossWeightDate' => $GrossWeightDate,'TareWeightDate' => $TareWeightDate,'TareWeight' => $TareWeight,'NetWeight' => $NetWeight,'UpdateBY' => $updateby);
|
||||||
|
|
||||||
|
if (!empty($requestWeightFileName)) {
|
||||||
|
if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) {
|
||||||
|
if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) {
|
||||||
|
log_message('error', 'File already exists in the database'.$requestWeightFileName);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$WeightFile->move($path, $requestWeightFileName);
|
||||||
|
$igr_lineitem['WeightFile'] = $requestWeightFileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$update = $this->inwardgateregister_model->updateIGRLineItem($igr_lineitem, $IGRItemNo);
|
$update = $this->inwardgateregister_model->updateIGRLineItem($igr_lineitem, $IGRItemNo);
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
|
|||||||
@ -904,4 +904,16 @@ class Inwardgateregister_model extends Model
|
|||||||
// Pass the result to the view or return it as JSON
|
// Pass the result to the view or return it as JSON
|
||||||
// return $this->response->setJSON($result);
|
// return $this->response->setJSON($result);
|
||||||
}
|
}
|
||||||
|
public function isFileExistsInIGRmaster($filename)
|
||||||
|
{
|
||||||
|
$result = $this->db->table('t_igr_master')->where('MasterFile', $filename);
|
||||||
|
$query = $result->get();
|
||||||
|
return $query->getResult();
|
||||||
|
}
|
||||||
|
public function isFileExistsInIGRdetails($filename)
|
||||||
|
{
|
||||||
|
$result = $this->db->table('t_igr_details')->where('WeightFile', $filename);
|
||||||
|
$query = $result->get();
|
||||||
|
return $query->getResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script>
|
||||||
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
||||||
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
||||||
@ -6,12 +5,12 @@
|
|||||||
#MaterialRcvdDate {
|
#MaterialRcvdDate {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
#InvoiceDate {
|
#InvoiceDate {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$("#PONO").select2();
|
$("#PONO").select2();
|
||||||
@ -19,11 +18,17 @@
|
|||||||
|
|
||||||
$("#InvoiceDate").datepicker({
|
$("#InvoiceDate").datepicker({
|
||||||
maxDate: 'now',
|
maxDate: 'now',
|
||||||
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
dateFormat: 'dd-mm-yy',
|
||||||
|
changeMonth: true,
|
||||||
|
changeYear: true,
|
||||||
|
yearRange: '-100:+0'
|
||||||
});
|
});
|
||||||
$("#MaterialRcvdDate").datepicker({
|
$("#MaterialRcvdDate").datepicker({
|
||||||
maxDate: 'now',
|
maxDate: 'now',
|
||||||
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
dateFormat: 'dd-mm-yy',
|
||||||
|
changeMonth: true,
|
||||||
|
changeYear: true,
|
||||||
|
yearRange: '-100:+0'
|
||||||
}).datepicker("setDate", new Date());
|
}).datepicker("setDate", new Date());
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -52,12 +57,15 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select2 {
|
.select2 {
|
||||||
width: 100% ! important;
|
width: 100% ! important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.num {
|
.num {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataTables_wrapper {
|
.dataTables_wrapper {
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
}
|
}
|
||||||
@ -66,20 +74,21 @@
|
|||||||
<div class="content-wrapper" style="min-height:537px;">
|
<div class="content-wrapper" style="min-height:537px;">
|
||||||
|
|
||||||
<section class="content-header">
|
<section class="content-header">
|
||||||
<h5><div class="pull-right hidden-xs">
|
<h5>
|
||||||
<b><div id="wizard_clock"></div></b>
|
<div class="pull-right hidden-xs">
|
||||||
</div></h5>
|
<b>
|
||||||
|
<div id="wizard_clock"></div>
|
||||||
|
</b>
|
||||||
|
</div>
|
||||||
|
</h5>
|
||||||
<h1>
|
<h1>
|
||||||
<center> Inward Gate Register </center>
|
<center> Inward Gate Register </center>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<section class="content" style="margin: 15px;"><br />
|
<section class="content" style="margin: 15px;"><br />
|
||||||
<div style="border:2px solid #333;">
|
<div style="border:2px solid #333;">
|
||||||
|
|
||||||
|
<form action="<?php echo base_url() ?>SaveIGR" method="post" enctype="multipart/form-data">
|
||||||
<form action ="<?php echo base_url()?>SaveIGR"
|
|
||||||
method="post" enctype="multipart/form-data">
|
|
||||||
<div class="row"><br /><br />
|
<div class="row"><br /><br />
|
||||||
<div id="content"> </div>
|
<div id="content"> </div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@ -160,35 +169,11 @@
|
|||||||
echo form_input($data);
|
echo form_input($data);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-md-3">
|
|
||||||
<label>Courier No</label>
|
|
||||||
<?php
|
|
||||||
// $data = array('name' => 'CourierNo','value' => set_value('CourierNo'),'id'=>'CourierNo', 'class' => 'form-control','onkeypress'=>'return isNumberKey(event);' );
|
|
||||||
// echo form_input($data);
|
|
||||||
?>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-md-12">
|
|
||||||
<div class="col-md-offset-4">
|
|
||||||
<div class="box-header">
|
|
||||||
<input type="file" accept=".png,.jpg,.pdf" id="myfile" name="myfile" />
|
|
||||||
<label for="photo">Select File to upload<br/></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12" style="margin-top: 10px;">
|
<div class="col-md-12" style="margin-top: 10px;">
|
||||||
|
|
||||||
<!-- <input type="button" class="btn btn-primary" id ="addemorebutton" value=" + ADD FILES.."> -->
|
|
||||||
<!-- <div id="newsdiv"></div>this div for add more section -->
|
|
||||||
<input type="hidden" name="hidecounters" id="hidecounters" value="0" />
|
|
||||||
<input type="hidden" name="hideconstants" id="hideconstants" value="0" />
|
|
||||||
<input type="hidden" name="hideIGRStatus" id="hideIGRStatus" value="0" />
|
<input type="hidden" name="hideIGRStatus" id="hideIGRStatus" value="0" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -209,9 +194,7 @@
|
|||||||
<th> </th>
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id ="IGRappend">
|
<tbody id="IGRappend"></tbody>
|
||||||
|
|
||||||
</tbody>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -222,7 +205,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="col-md-4 col-md-offset-8">
|
<div class="col-md-4 col-md-offset-8">
|
||||||
<input type="file" name="browseFiles1" id="images1" onchange="Copyfilenames(this.name); "><br>
|
<input type="file" name="MasterFile" id="images1" onchange="Copyfilenames(this.name); "><br>
|
||||||
<button class="btn btn-success" id='IGRDraftLink' type="submit" name='IGRDraftLink' onclick="filecheck(0);">Draft IGR</button>
|
<button class="btn btn-success" id='IGRDraftLink' type="submit" name='IGRDraftLink' onclick="filecheck(0);">Draft IGR</button>
|
||||||
<button class="btn btn-success" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck(1);">Generate IGR</button>
|
<button class="btn btn-success" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck(1);">Generate IGR</button>
|
||||||
</div>
|
</div>
|
||||||
@ -240,7 +223,9 @@
|
|||||||
|
|
||||||
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<center><h4>Inward Gate Register Number</h4></center>
|
<center>
|
||||||
|
<h4>Inward Gate Register Number</h4>
|
||||||
|
</center>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12"> <br />
|
<div class="col-md-12"> <br />
|
||||||
|
|
||||||
@ -265,9 +250,13 @@
|
|||||||
|
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<center><h4>Weight Calculator</h4><div id="WeightTitle"></div></center>
|
<center>
|
||||||
|
<h4>Weight Calculator<span id="WeightTitle"></span></h4>
|
||||||
|
</center>
|
||||||
<div class="pull-right hidden-xs">
|
<div class="pull-right hidden-xs">
|
||||||
<b><div id="clock"></div></b>
|
<b>
|
||||||
|
<div id="clock"></div>
|
||||||
|
</b>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12"> <br />
|
<div class="col-md-12"> <br />
|
||||||
@ -316,6 +305,10 @@
|
|||||||
echo form_input($data);
|
echo form_input($data);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input type="file" name="WeightFile" id="WeightFile" onchange="Copyfilenames(this.name); "><br>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
@ -351,70 +344,47 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function validate() {
|
||||||
function validate()
|
|
||||||
{
|
|
||||||
var rowcount = $("#txtRowCount").val();
|
var rowcount = $("#txtRowCount").val();
|
||||||
|
|
||||||
var Noval = 0;
|
var Noval = 0;
|
||||||
var isExceed = 0;
|
var isExceed = 0;
|
||||||
for(k=1;k<=rowcount ; k++)
|
for (k = 1; k <= rowcount; k++) {
|
||||||
{
|
var InvoiceQty = parseFloat($('#QuantityAsPerInvoice' + k).val() == '' ? '0.00' : $('#QuantityAsPerInvoice' + k).val());
|
||||||
var AdvisedQty = parseFloat( $('#QuantityAsPerInvoice'+k).val() == '' ? '0.00' : $('#QuantityAsPerInvoice'+k).val());
|
|
||||||
var RecQty = parseFloat($('#txtReceivedQuantity' + k).val() == '' ? '0.00' : $('#txtReceivedQuantity' + k).val());
|
var RecQty = parseFloat($('#txtReceivedQuantity' + k).val() == '' ? '0.00' : $('#txtReceivedQuantity' + k).val());
|
||||||
var OrderedQty = parseFloat($('#Quantity_1' + k).text());
|
var OrderedQty = parseFloat($('#Quantity_1' + k).text());
|
||||||
if(AdvisedQty != '0.00')
|
if (InvoiceQty != '0.00') {
|
||||||
{
|
|
||||||
|
|
||||||
if(OrderedQty < (AdvisedQty+RecQty))
|
if (OrderedQty < (InvoiceQty + RecQty)) {
|
||||||
{
|
|
||||||
isExceed = 1;
|
isExceed = 1;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Noval = 1;
|
Noval = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($('#PONO').val() == '-1') {
|
||||||
|
|
||||||
if($('#PONO').val()=='-1')
|
|
||||||
{
|
|
||||||
|
|
||||||
alert("Please select PurchaseOrder");
|
alert("Please select PurchaseOrder");
|
||||||
$('#PONO').focus();
|
$('#PONO').focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if ($('#InvoiceNo').val() == '') {
|
||||||
else if($('#InvoiceNo').val() == '' )
|
|
||||||
{
|
|
||||||
alert('Please Enter Invoice Number');
|
alert('Please Enter Invoice Number');
|
||||||
$('#InvoiceNo').focus();
|
$('#InvoiceNo').focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if ($('#InvoiceDate').val() == '') {
|
||||||
else if($('#InvoiceDate').val() == '' )
|
|
||||||
{
|
|
||||||
alert('Please Enter Invoice Date');
|
alert('Please Enter Invoice Date');
|
||||||
$('#InvoiceDate').focus();
|
$('#InvoiceDate').focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if ($('#MaterialRcvdDate').val() == '') {
|
||||||
else if($('#MaterialRcvdDate').val() == '' )
|
|
||||||
{
|
|
||||||
alert('Please Enter Material Received Date');
|
alert('Please Enter Material Received Date');
|
||||||
$('#MaterialRcvdDate').focus();
|
$('#MaterialRcvdDate').focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (Noval == 0) {
|
||||||
else if (Noval == 0 )
|
alert('Invoice Quantity is Empty.Please Enter the value');
|
||||||
{
|
|
||||||
|
|
||||||
alert('Advised Quantity is Empty.Please Enter the value');
|
|
||||||
return false;
|
return false;
|
||||||
|
} else if (isExceed == 1) {
|
||||||
}
|
alert("Invoice Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||||
else if(isExceed == 1 ){
|
|
||||||
|
|
||||||
alert("Advised Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,30 +398,29 @@ function validate()
|
|||||||
"ordering": false,
|
"ordering": false,
|
||||||
"info": false,
|
"info": false,
|
||||||
"autoWidth": false
|
"autoWidth": false
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// $(function() {
|
// $(function() {
|
||||||
function removeHidden()
|
function removeHidden() {
|
||||||
{
|
|
||||||
var rowcount = $("#txtRowCount").val();
|
var rowcount = $("#txtRowCount").val();
|
||||||
for(k=1;k<=rowcount ; k++)
|
for (k = 1; k <= rowcount; k++) {
|
||||||
{
|
|
||||||
$("#MaterialCode" + k).remove();
|
$("#MaterialCode" + k).remove();
|
||||||
$("#txtQuantityAsPerInvoice" + k).remove();
|
$("#txtQuantityAsPerInvoice" + k).remove();
|
||||||
$("#OrderedQuantity" + k).remove();
|
$("#OrderedQuantity" + k).remove();
|
||||||
$("#txtReceivedQuantity" + k).remove();
|
$("#txtReceivedQuantity" + k).remove();
|
||||||
$("#txtRemarks" + k).remove();
|
$("#txtRemarks" + k).remove();
|
||||||
$("#txtPendingQty" + k).remove();
|
$("#txtPendingQty" + k).remove();
|
||||||
|
|
||||||
$("#txtGrossWeight" + k).remove();
|
$("#txtGrossWeight" + k).remove();
|
||||||
$("#txtGrossWeightDate" + k).remove();
|
$("#txtGrossWeightDate" + k).remove();
|
||||||
$("#txtTareWeight" + k).remove();
|
$("#txtTareWeight" + k).remove();
|
||||||
$("#txtTareWeightDate" + k).remove();
|
$("#txtTareWeightDate" + k).remove();
|
||||||
$("#txtNetWeight" + k).remove();
|
$("#txtNetWeight" + k).remove();
|
||||||
|
$("#txtWeightFile" + k).remove();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,30 +428,22 @@ function validate()
|
|||||||
removeHidden();
|
removeHidden();
|
||||||
$("#IGRappend").empty();
|
$("#IGRappend").empty();
|
||||||
$('#txtRowCount').val('');
|
$('#txtRowCount').val('');
|
||||||
|
|
||||||
var id = $('#PONO').val();
|
var id = $('#PONO').val();
|
||||||
var status = '';
|
var status = '';
|
||||||
if(id != '-1')
|
if (id != '-1') {
|
||||||
{
|
|
||||||
|
|
||||||
$('#content').loader('show');
|
$('#content').loader('show');
|
||||||
var y = <?php echo json_encode($PO_NO, JSON_PRETTY_PRINT) ?>;
|
var y = <?php echo json_encode($PO_NO, JSON_PRETTY_PRINT) ?>;
|
||||||
|
|
||||||
$.each(y, function(idx, obj) {
|
$.each(y, function(idx, obj) {
|
||||||
|
if (id == obj.PONO) {
|
||||||
if(id == obj.PONO)
|
|
||||||
{
|
|
||||||
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
||||||
var newUrl = baseUrl + '?PONO=' + obj.PONO + '&ReqType=' + obj.POType;
|
var newUrl = baseUrl + '?PONO=' + obj.PONO + '&ReqType=' + obj.POType;
|
||||||
$('#printLink').attr('href', newUrl);
|
$('#printLink').attr('href', newUrl);
|
||||||
|
|
||||||
$("#po").val(obj.PONO);
|
$("#po").val(obj.PONO);
|
||||||
$("#Sup").val(obj.SupplierName);
|
$("#Sup").val(obj.SupplierName);
|
||||||
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
|
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
|
||||||
var isOpenOrder = parseInt(obj.IsOpenOrder, 2);
|
var isOpenOrder = parseInt(obj.IsOpenOrder, 2);
|
||||||
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
|
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
|
||||||
$('.help-block').text(formatted_IsOpenOrder);
|
$('.help-block').text(formatted_IsOpenOrder);
|
||||||
|
|
||||||
//$("#Add").val(obj.Address);
|
//$("#Add").val(obj.Address);
|
||||||
$("#del").val(obj.DeliveryDate);
|
$("#del").val(obj.DeliveryDate);
|
||||||
//$("#ser").val(obj.ServiceDescription);
|
//$("#ser").val(obj.ServiceDescription);
|
||||||
@ -490,31 +451,21 @@ function validate()
|
|||||||
ostatus = obj.OGR_Status;
|
ostatus = obj.OGR_Status;
|
||||||
formatted_PODate = obj.formatted_PODate;
|
formatted_PODate = obj.formatted_PODate;
|
||||||
formatted_IsOpenOrder = obj.formatted_IsOpenOrder;
|
formatted_IsOpenOrder = obj.formatted_IsOpenOrder;
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//alert(ostatus)
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: { id: id },
|
data: { id: id },
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo base_url() ?>GetIGRLineItemDetails",
|
url: "<?php echo base_url() ?>GetIGRLineItemDetails",
|
||||||
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
|
||||||
//alert(data);
|
|
||||||
|
|
||||||
$('#content').loader('hide');
|
$('#content').loader('hide');
|
||||||
//alert(data);
|
//alert(data);
|
||||||
var trHTML = '';
|
var trHTML = '';
|
||||||
|
|
||||||
var j = 0;
|
var j = 0;
|
||||||
var showTable = false;
|
var showTable = false;
|
||||||
|
|
||||||
|
|
||||||
$.each(JSON.parse(data), function(i, item) {
|
$.each(JSON.parse(data), function(i, item) {
|
||||||
showTable = true;
|
showTable = true;
|
||||||
|
|
||||||
if (showTable) {
|
if (showTable) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
@ -527,13 +478,8 @@ function validate()
|
|||||||
'<td name="ReceivedQuantity' + i + '" id="ReceivedQuantity' + i + '">' + item.ReceivedQuantity + '</td>' +
|
'<td name="ReceivedQuantity' + i + '" id="ReceivedQuantity' + i + '">' + item.ReceivedQuantity + '</td>' +
|
||||||
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + item.PendingQty + '</td>' +
|
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + item.PendingQty + '</td>' +
|
||||||
'<td data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="" onkeypress="return isNumberKey(event);"></td>' +
|
'<td data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="" onkeypress="return isNumberKey(event);"></td>' +
|
||||||
|
|
||||||
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')"> </td>' +
|
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')"> </td>' +
|
||||||
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'</tr>';
|
'</tr>';
|
||||||
$('#txtRowCount').val(i);
|
$('#txtRowCount').val(i);
|
||||||
|
|
||||||
@ -543,18 +489,18 @@ function validate()
|
|||||||
value: item.MaterialCode,
|
value: item.MaterialCode,
|
||||||
name: 'MaterialCode' + i
|
name: 'MaterialCode' + i
|
||||||
}).appendTo('form');
|
}).appendTo('form');
|
||||||
|
|
||||||
$('<input>').attr({
|
$('<input>').attr({
|
||||||
type: 'hidden',
|
type: 'hidden',
|
||||||
id: 'txtQuantityAsPerInvoice' + i,
|
id: 'txtQuantityAsPerInvoice' + i,
|
||||||
name: 'txtQuantityAsPerInvoice' + i
|
name: 'txtQuantityAsPerInvoice' + i
|
||||||
}).appendTo('form');
|
}).appendTo('form');
|
||||||
|
|
||||||
$('<input>').attr({
|
$('<input>').attr({
|
||||||
type: 'hidden',
|
type: 'hidden',
|
||||||
id: 'OrderedQuantity' + i,
|
id: 'OrderedQuantity' + i,
|
||||||
|
|
||||||
value: item.Quantity,
|
value: item.Quantity,
|
||||||
name: 'OrderedQuantity' + i
|
name: 'OrderedQuantity' + i
|
||||||
|
|
||||||
}).appendTo('form');
|
}).appendTo('form');
|
||||||
|
|
||||||
$('<input>').attr({
|
$('<input>').attr({
|
||||||
@ -576,30 +522,35 @@ $('<input>').attr({
|
|||||||
name: 'txtPendingQty' + i,
|
name: 'txtPendingQty' + i,
|
||||||
value: item.PendingQty
|
value: item.PendingQty
|
||||||
}).appendTo('form');
|
}).appendTo('form');
|
||||||
|
|
||||||
$('<input>').attr({
|
$('<input>').attr({
|
||||||
type: 'hidden',
|
type: 'hidden',
|
||||||
id: 'txtGrossWeight' + i,
|
id: 'txtGrossWeight' + i,
|
||||||
value: item.GrossWeight,
|
value: item.GrossWeight,
|
||||||
name: 'txtGrossWeight' + i
|
name: 'txtGrossWeight' + i
|
||||||
}).appendTo('form');
|
}).appendTo('form');
|
||||||
|
|
||||||
$('<input>').attr({
|
$('<input>').attr({
|
||||||
type: 'hidden',
|
type: 'hidden',
|
||||||
id: 'txtGrossWeightDate' + i,
|
id: 'txtGrossWeightDate' + i,
|
||||||
value: item.GrossWeightDate,
|
value: item.GrossWeightDate,
|
||||||
name: 'txtGrossWeightDate' + i
|
name: 'txtGrossWeightDate' + i
|
||||||
}).appendTo('form');
|
}).appendTo('form');
|
||||||
|
|
||||||
$('<input>').attr({
|
$('<input>').attr({
|
||||||
type: 'hidden',
|
type: 'hidden',
|
||||||
id: 'txtTareWeight' + i,
|
id: 'txtTareWeight' + i,
|
||||||
value: item.TareWeight,
|
value: item.TareWeight,
|
||||||
name: 'txtTareWeight' + i
|
name: 'txtTareWeight' + i
|
||||||
}).appendTo('form');
|
}).appendTo('form');
|
||||||
|
|
||||||
$('<input>').attr({
|
$('<input>').attr({
|
||||||
type: 'hidden',
|
type: 'hidden',
|
||||||
id: 'txtTareWeightDate' + i,
|
id: 'txtTareWeightDate' + i,
|
||||||
value: item.TareWeightDate,
|
value: item.TareWeightDate,
|
||||||
name: 'txtTareWeightDate' + i
|
name: 'txtTareWeightDate' + i
|
||||||
}).appendTo('form');
|
}).appendTo('form');
|
||||||
|
|
||||||
$('<input>').attr({
|
$('<input>').attr({
|
||||||
type: 'hidden',
|
type: 'hidden',
|
||||||
id: 'txtNetWeight' + i,
|
id: 'txtNetWeight' + i,
|
||||||
@ -607,102 +558,77 @@ $('<input>').attr({
|
|||||||
name: 'txtNetWeight' + i
|
name: 'txtNetWeight' + i
|
||||||
}).appendTo('form');
|
}).appendTo('form');
|
||||||
|
|
||||||
//alert(item.PendingQty);
|
$('<input>').attr({
|
||||||
if(item.PendingQty == 0.00)
|
type: 'file',
|
||||||
{
|
id: 'txtWeightFile' + i,
|
||||||
//alert('inside if');
|
value: item.WeightFile,
|
||||||
|
name: 'txtWeightFile' + i,
|
||||||
|
style: 'display:none;' // This makes the input hidden
|
||||||
|
}).appendTo('form'); // Make sure the form has the id 'IGR'
|
||||||
|
|
||||||
|
if (item.PendingQty == 0.00) {
|
||||||
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
|
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
|
||||||
// $('#txtEditFreight').attr('readonly', 'true');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#IGRLink").show();
|
$("#IGRLink").show();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
if (JSON.parse(data).length == 1 && item.PendingQty == 0) {
|
if (JSON.parse(data).length == 1 && item.PendingQty == 0) {
|
||||||
|
|
||||||
$("#IGRLink").hide();
|
$("#IGRLink").hide();
|
||||||
//alert('The Order is new completed!!');
|
//alert('The Order is new completed!!');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$("#IGRappend").empty();
|
$("#IGRappend").empty();
|
||||||
|
|
||||||
|
|
||||||
$('#IGRappend').append(trHTML);
|
$('#IGRappend').append(trHTML);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>'))
|
if ((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>')) {
|
||||||
{
|
|
||||||
alert('The Order is completed!!');
|
alert('The Order is completed!!');
|
||||||
|
|
||||||
$("#IGRLink").hide();
|
$("#IGRLink").hide();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#IGRLink").show();
|
$("#IGRLink").show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
alert('Please Select the Purchase Order Number to Create IGR');
|
alert('Please Select the Purchase Order Number to Create IGR');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function SetRemarks(RowId)
|
function SetRemarks(RowId) {
|
||||||
{
|
|
||||||
var remks = $("#Remark" + RowId).val();
|
var remks = $("#Remark" + RowId).val();
|
||||||
if( remks != '')
|
if (remks != '') {
|
||||||
{
|
|
||||||
$("#txtRemarks" + RowId).val(remks);
|
$("#txtRemarks" + RowId).val(remks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateReceivedQuantity(Rowid) {
|
function validateReceivedQuantity(Rowid) {
|
||||||
//alert(Rowid);
|
//alert(Rowid);
|
||||||
|
|
||||||
var InvoiceQty = parseFloat($('#QuantityAsPerInvoice' + Rowid).val() == '' ? '0.00' : $('#QuantityAsPerInvoice' + Rowid).val());
|
var InvoiceQty = parseFloat($('#QuantityAsPerInvoice' + Rowid).val() == '' ? '0.00' : $('#QuantityAsPerInvoice' + Rowid).val());
|
||||||
|
|
||||||
var PendingQty = parseFloat($('#PendingQuantity' + Rowid).text() == '' ? '0.00' : $('#PendingQuantity' + Rowid).text());
|
var PendingQty = parseFloat($('#PendingQuantity' + Rowid).text() == '' ? '0.00' : $('#PendingQuantity' + Rowid).text());
|
||||||
|
|
||||||
var RecQty = parseFloat($('#txtReceivedQuantity' + Rowid).val() == '' ? '0.00' : $('#txtReceivedQuantity' + Rowid).val());
|
var RecQty = parseFloat($('#txtReceivedQuantity' + Rowid).val() == '' ? '0.00' : $('#txtReceivedQuantity' + Rowid).val());
|
||||||
|
|
||||||
var OrderedQty = parseFloat($("#Quantity_1" + Rowid).text());
|
var OrderedQty = parseFloat($("#Quantity_1" + Rowid).text());
|
||||||
|
|
||||||
var r = $("#Remark" + Rowid).val();
|
var r = $("#Remark" + Rowid).val();
|
||||||
// alert(RecQty);
|
|
||||||
//alert(InvoiceQty);
|
|
||||||
if((InvoiceQty+RecQty) > OrderedQty){
|
|
||||||
|
|
||||||
alert("Advised Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
if ((InvoiceQty + RecQty) > OrderedQty) {
|
||||||
|
alert("Invoice Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||||
$("#QuantityAsPerInvoice" + Rowid).focus();
|
$("#QuantityAsPerInvoice" + Rowid).focus();
|
||||||
$("#QuantityAsPerInvoice" + Rowid).val('');
|
$("#QuantityAsPerInvoice" + Rowid).val('');
|
||||||
return false;
|
return false;
|
||||||
|
} else if (((InvoiceQty + RecQty) - OrderedQty) > 0.00) {
|
||||||
|
|
||||||
}
|
|
||||||
else if(((InvoiceQty+RecQty) - OrderedQty) > 0.00){
|
|
||||||
alert("Order is completed.")
|
alert("Order is completed.")
|
||||||
$("#QuantityAsPerInvoice" + Rowid).focus();
|
$("#QuantityAsPerInvoice" + Rowid).focus();
|
||||||
$('#QuantityAsPerInvoice' + Rowid).val('');
|
$('#QuantityAsPerInvoice' + Rowid).val('');
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
// alert(RecQty);
|
// alert(RecQty);
|
||||||
$('#PendingQuantity' + Rowid).text((OrderedQty - (InvoiceQty + RecQty)).toFixed(2));
|
$('#PendingQuantity' + Rowid).text((OrderedQty - (InvoiceQty + RecQty)).toFixed(2));
|
||||||
$('#txtPendingQty' + Rowid).val(OrderedQty - (InvoiceQty + RecQty));
|
$('#txtPendingQty' + Rowid).val(OrderedQty - (InvoiceQty + RecQty));
|
||||||
@ -711,238 +637,39 @@ function validateReceivedQuantity(Rowid){
|
|||||||
// InvoiceQty
|
// InvoiceQty
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function isNumberKey(evt) {
|
||||||
function isNumberKey(evt)
|
|
||||||
{
|
|
||||||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||||||
if (charCode != 46 && charCode > 31
|
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
|
||||||
&& (charCode < 48 || charCode > 57))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Save(status)
|
function Save(status) {
|
||||||
{
|
if (validate()) {
|
||||||
if (validate())
|
|
||||||
{
|
|
||||||
var file = $('#images'+counterConstants).val()
|
|
||||||
$("#IGR").attr("method", "post");
|
$("#IGR").attr("method", "post");
|
||||||
$("#IGR").attr("enctype", "multipart/form-data");
|
$("#IGR").attr("enctype", "multipart/form-data");
|
||||||
$("#IGR").attr("action", "SaveIGR");
|
$("#IGR").attr("action", "SaveIGR");
|
||||||
$('#IGR').submit();
|
$('#IGR').submit();
|
||||||
} //validate if closed
|
} //validate if closed
|
||||||
} //save function closed
|
} //save function closed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
function filecheck(status) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var counters = 0;
|
|
||||||
var counterConstants = 0;
|
|
||||||
|
|
||||||
$("#addemorebutton").click(function(){
|
|
||||||
|
|
||||||
//alert('sda');
|
|
||||||
|
|
||||||
if(counters>4){
|
|
||||||
alert("No more files to add");//this allows only 5 files;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
counters++;
|
|
||||||
counterConstants++;
|
|
||||||
|
|
||||||
var div = document.createElement('div');
|
|
||||||
div.id = "divid"+counters;
|
|
||||||
div.className="row";
|
|
||||||
div.innerHTML='<div class="col-md-12">'+
|
|
||||||
|
|
||||||
'<div class="col-md-3">'+
|
|
||||||
'<label><br></label>'+
|
|
||||||
'<input type="file" id="images" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+
|
|
||||||
'</div>'+
|
|
||||||
|
|
||||||
'<div class="col-md-1">'+
|
|
||||||
'<label><br><br></label>'+
|
|
||||||
'<button class="btn btn-success" type ="button" onclick="addRow('+counters+')"id="addbtn1" ><i class="fa fa-plus-square"></i></button></div>'+
|
|
||||||
|
|
||||||
'<div class="col-md-1">'+
|
|
||||||
'<label><br><br></label>'+
|
|
||||||
'<button class="btn btn-danger remove remove_this" type ="button" id="removebtn'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i> </button></div>'+
|
|
||||||
|
|
||||||
|
|
||||||
'</div>';
|
|
||||||
$('#newsdiv').append(div);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#hidecounters').val(counters);
|
|
||||||
$('#hideconstants').val(counterConstants);
|
|
||||||
|
|
||||||
if(counters > 1){
|
|
||||||
alert("Add button click here");//this allows only 5 files;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
$('#addemorebutton').hide();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// document.write("browseFiles"+length);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function addRow(inputs)
|
|
||||||
{ if(inputs <5){
|
|
||||||
if(inputs ==0){
|
|
||||||
inputs = inputs+1;
|
|
||||||
$("#addbtn"+inputs).hide();
|
|
||||||
$("#removebtn"+inputs).hide();
|
|
||||||
}else{
|
|
||||||
$("#addbtn"+inputs).hide();
|
|
||||||
$("#removebtn"+inputs).hide();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$("#addbtn"+inputs).show();
|
|
||||||
$("#removebtn"+inputs).show();
|
|
||||||
}
|
|
||||||
// alert(s);
|
|
||||||
if(counters>4){
|
|
||||||
alert("No more files to add");//this allows only 5 files;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
counters++;
|
|
||||||
counterConstants++;
|
|
||||||
//alert("count"+counterConstants);
|
|
||||||
var div = document.createElement('div');
|
|
||||||
div.id = "divid"+counters;
|
|
||||||
div.className="row";
|
|
||||||
div.innerHTML='<div class="col-md-12">'+
|
|
||||||
|
|
||||||
'<div class="col-md-3">'+
|
|
||||||
'<label><br></label>'+
|
|
||||||
'<input type="file" name="browseFiles'+counterConstants+'" id="images1" onchange="Copyfilenames(this.name); "><br>'+
|
|
||||||
'</div>'+
|
|
||||||
'<div class="col-md-1">'+
|
|
||||||
'<label><br><br></label>'+
|
|
||||||
'<button class="btn btn-success" type ="button" id="addbtn'+counters+'" onclick="addRow('+counters+')"><i class="fa fa-plus-square"></i></button></div>'+
|
|
||||||
|
|
||||||
'<div class="col-md-1">'+
|
|
||||||
'<label><br><br></label>'+
|
|
||||||
'<button class="btn btn-danger remove remove_this" type ="button" id="removebtn'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>'+
|
|
||||||
'</div>'+
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'</div>';
|
|
||||||
$('#newsdiv').append(div);
|
|
||||||
|
|
||||||
|
|
||||||
$('#hidecounters').val(counters);
|
|
||||||
$('#hideconstants').val(counterConstants);
|
|
||||||
|
|
||||||
|
|
||||||
if(counters > 1){
|
|
||||||
//alert("Next File choose + button click here");//this allows only 5 files;
|
|
||||||
//return false;
|
|
||||||
$('#addbtn').hide();
|
|
||||||
$("#removebtn").hide();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
$('#addemorebutton').hide();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function filecheck(status)
|
|
||||||
{
|
|
||||||
$('#hideIGRStatus').val(status);
|
$('#hideIGRStatus').val(status);
|
||||||
$('#hidecounters').val(1);
|
|
||||||
$('#hideconstants').val(1);
|
|
||||||
|
|
||||||
var file1 = $('#images').val();
|
|
||||||
|
|
||||||
if(file1=='')
|
|
||||||
{
|
|
||||||
alert('File not Found');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Save(status);
|
Save(status);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function Copyfilenames(id)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
function Copyfilenames(id) {
|
||||||
var size = $('input[name=' + id + ']')[0].files[0].size;
|
var size = $('input[name=' + id + ']')[0].files[0].size;
|
||||||
|
|
||||||
var number = id.replace(/[^0-9]+/ig,"");
|
|
||||||
|
|
||||||
if (size > 2100000) {
|
if (size > 2100000) {
|
||||||
//alert(id);
|
|
||||||
alert('Sorry Your File is Large To 2MB');
|
alert('Sorry Your File is Large To 2MB');
|
||||||
removeRows(id);
|
|
||||||
//$('input[name = browseFiles'+number+']').val(' ');
|
|
||||||
} else {
|
} else {
|
||||||
var name = $('input[name=' + id + ']')[0].files[0].name;
|
var name = $('input[name=' + id + ']')[0].files[0].name;
|
||||||
//alert(name);
|
|
||||||
//$("#maint_filename"+number).val(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function removeRows(inputs) {
|
|
||||||
// alert(input);
|
|
||||||
var number = inputs.replace(/[^0-9]+/ig,"");
|
|
||||||
//alert(number);
|
|
||||||
if(counters >= 1){
|
|
||||||
counters --;
|
|
||||||
|
|
||||||
$("#divid"+number).remove();
|
|
||||||
$('#hidecounters').val(counters);
|
|
||||||
}
|
|
||||||
|
|
||||||
var rm_count = $("#hideconstants").val();
|
|
||||||
if(counters !=0){
|
|
||||||
if(number != rm_count){
|
|
||||||
// alert("if");
|
|
||||||
$("#addbtn"+counters).show();
|
|
||||||
$("#removebtn"+counters).show();
|
|
||||||
}else{
|
|
||||||
//alert('else');
|
|
||||||
$("#addbtn"+counters).show();
|
|
||||||
$("#removebtn"+counters).show();
|
|
||||||
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$("#addemorebutton").show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -960,6 +687,7 @@ function removeRows(inputs) {
|
|||||||
WeightDiffer(element)
|
WeightDiffer(element)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTime() {
|
function updateTime() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const year = now.getFullYear();
|
const year = now.getFullYear();
|
||||||
@ -973,15 +701,14 @@ function removeRows(inputs) {
|
|||||||
document.getElementById('clock').textContent = dateString + " " + timeString;
|
document.getElementById('clock').textContent = dateString + " " + timeString;
|
||||||
document.getElementById('wizard_clock').textContent = dateString + " " + timeString;
|
document.getElementById('wizard_clock').textContent = dateString + " " + timeString;
|
||||||
}
|
}
|
||||||
setInterval(updateTime, 1000); // Update every second
|
setInterval(updateTime, 1000);
|
||||||
updateTime(); // Initial call to display time immediately
|
updateTime();
|
||||||
function WeightDiffer(element)
|
function WeightDiffer(element) {
|
||||||
{
|
|
||||||
// console.log(element);
|
|
||||||
var v1 = $("#GrossWeight").val();
|
var v1 = $("#GrossWeight").val();
|
||||||
var v2 = $("#TareWeight").val();
|
var v2 = $("#TareWeight").val();
|
||||||
var v3 = v1 - v2;
|
var v3 = v1 - v2;
|
||||||
$("#NetWeight").val(v3);
|
$("#NetWeight").val(v3);
|
||||||
|
|
||||||
if (element.id === 'GrossWeight') {
|
if (element.id === 'GrossWeight') {
|
||||||
$("#GrossWeightDate").val($("#clock").text());
|
$("#GrossWeightDate").val($("#clock").text());
|
||||||
}
|
}
|
||||||
@ -990,15 +717,13 @@ function removeRows(inputs) {
|
|||||||
$("#TareWeightDate").val($("#clock").text());
|
$("#TareWeightDate").val($("#clock").text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$("#WeightCalculator").on("shown.bs.modal", function(e) {
|
$("#WeightCalculator").on("shown.bs.modal", function(e) {
|
||||||
var inx = $(e.relatedTarget).data('index');
|
var inx = $(e.relatedTarget).data('index');
|
||||||
var material = $(e.relatedTarget).data('material');
|
var material = $(e.relatedTarget).data('material');
|
||||||
|
|
||||||
document.getElementById('WeightTitle').textContent = " ( "+material+" )";
|
$('#WeightTitle').text(" ( " + material + " )");
|
||||||
|
|
||||||
|
|
||||||
// Clear the modal inputs
|
// Clear the modal inputs
|
||||||
$("#GrossWeight").val('');
|
$("#GrossWeight").val('');
|
||||||
@ -1013,14 +738,10 @@ function removeRows(inputs) {
|
|||||||
var v3 = $("#txtTareWeight" + inx).val();
|
var v3 = $("#txtTareWeight" + inx).val();
|
||||||
var v4 = $("#txtTareWeightDate" + inx).val();
|
var v4 = $("#txtTareWeightDate" + inx).val();
|
||||||
var v5 = $("#txtNetWeight" + inx).val();
|
var v5 = $("#txtNetWeight" + inx).val();
|
||||||
|
var fileInput = $("#txtWeightFile" + inx)[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Debugging alerts
|
|
||||||
// console.log("v1:", v1);
|
|
||||||
// console.log("v2:", v2);
|
|
||||||
// console.log("v3:", v3);
|
|
||||||
// console.log("v4:", v4);
|
|
||||||
// console.log("v5:", v5);
|
|
||||||
console.log("Selected values for index:", typeof inx, inx);
|
console.log("Selected values for index:", typeof inx, inx);
|
||||||
|
|
||||||
// Set modal inputs with the retrieved values
|
// Set modal inputs with the retrieved values
|
||||||
@ -1030,6 +751,20 @@ function removeRows(inputs) {
|
|||||||
$("#TareWeightDate").val(v4);
|
$("#TareWeightDate").val(v4);
|
||||||
$("#NetWeight").val(v5);
|
$("#NetWeight").val(v5);
|
||||||
$("#CurrentInx").val(inx);
|
$("#CurrentInx").val(inx);
|
||||||
|
if (fileInput && fileInput.files.length > 0) {
|
||||||
|
var targetInput = $("#WeightFile")[0];
|
||||||
|
var file = fileInput.files[0];
|
||||||
|
|
||||||
|
// Create a new DataTransfer object
|
||||||
|
var dataTransfer = new DataTransfer();
|
||||||
|
dataTransfer.items.add(file);
|
||||||
|
|
||||||
|
// Set the file to the target input
|
||||||
|
targetInput.files = dataTransfer.files;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log("No file selected or file input not found.");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function modalSave() {
|
function modalSave() {
|
||||||
@ -1038,23 +773,34 @@ function modalSave() {
|
|||||||
var v3 = $("#TareWeight").val();
|
var v3 = $("#TareWeight").val();
|
||||||
var v4 = $("#TareWeightDate").val();
|
var v4 = $("#TareWeightDate").val();
|
||||||
var v5 = $("#NetWeight").val();
|
var v5 = $("#NetWeight").val();
|
||||||
var v6 = $("#CurrentInx").val();
|
var inx = $("#CurrentInx").val();
|
||||||
|
var fileInput = $("#WeightFile")[0]; // Get the file input element
|
||||||
|
|
||||||
// Debugging alerts
|
if (inx !== undefined && inx !== '') {
|
||||||
// console.log("v1:", v1);
|
console.log("Saving values for index:", inx);
|
||||||
// console.log("v2:", v2);
|
|
||||||
// console.log("v3:", v3);
|
|
||||||
// console.log("v4:", v4);
|
|
||||||
// console.log("v5:", v5);
|
|
||||||
if (v6 !== undefined && v6 !== '') {
|
|
||||||
console.log("Saving values for index:", v6);
|
|
||||||
|
|
||||||
// Set the values back to the hidden inputs
|
// Set the values back to the hidden inputs
|
||||||
$("#txtGrossWeight" + v6).val(v1);
|
$("#txtGrossWeight" + inx).val(v1);
|
||||||
$("#txtGrossWeightDate" + v6).val(v2);
|
$("#txtGrossWeightDate" + inx).val(v2);
|
||||||
$("#txtTareWeight" + v6).val(v3);
|
$("#txtTareWeight" + inx).val(v3);
|
||||||
$("#txtTareWeightDate" + v6).val(v4);
|
$("#txtTareWeightDate" + inx).val(v4);
|
||||||
$("#txtNetWeight" + v6).val(v5);
|
$("#txtNetWeight" + inx).val(v5);
|
||||||
|
|
||||||
|
if (fileInput && fileInput.files.length > 0) {
|
||||||
|
var targetInput = $("#txtWeightFile" + inx)[0];
|
||||||
|
var file = fileInput.files[0];
|
||||||
|
|
||||||
|
// Create a new DataTransfer object
|
||||||
|
var dataTransfer = new DataTransfer();
|
||||||
|
dataTransfer.items.add(file);
|
||||||
|
|
||||||
|
// Set the file to the target input
|
||||||
|
targetInput.files = dataTransfer.files;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log("No file selected or file input not found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Clear modal inputs
|
// Clear modal inputs
|
||||||
$("#GrossWeight").val('');
|
$("#GrossWeight").val('');
|
||||||
@ -1062,12 +808,12 @@ function modalSave() {
|
|||||||
$("#TareWeight").val('');
|
$("#TareWeight").val('');
|
||||||
$("#TareWeightDate").val('');
|
$("#TareWeightDate").val('');
|
||||||
$("#NetWeight").val('');
|
$("#NetWeight").val('');
|
||||||
|
$("#WeightFile").val('');
|
||||||
|
|
||||||
// Close the modal
|
// Close the modal
|
||||||
$("#WeightCalculator").modal('hide');
|
$("#WeightCalculator").modal('hide');
|
||||||
} else {
|
} else {
|
||||||
console.log("Saving values for index: "+v6+" undefined");
|
console.log("Saving values for index: " + inx + " undefined");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -248,6 +248,12 @@
|
|||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<!-- <a class="btn btn-primary" id="update" value="Update">Update</a> -->
|
<!-- <a class="btn btn-primary" id="update" value="Update">Update</a> -->
|
||||||
|
<div class="col-md-4 col-md-offset-8">
|
||||||
|
<input type="file" name="MasterFile" id="MasterFile" onchange="Copyfilenames(this.name); ">
|
||||||
|
<label id="MasterFileLabel" style="display:none;">
|
||||||
|
<a><span></span><small></small></a>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="buttonContainer">
|
<div class="buttonContainer">
|
||||||
<a class="btn btn-primary" id="draftIGR" value="draftIGR">Draft IGR</a>
|
<a class="btn btn-primary" id="draftIGR" value="draftIGR">Draft IGR</a>
|
||||||
@ -322,6 +328,13 @@
|
|||||||
echo form_input($data);
|
echo form_input($data);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input type="file" name="WeightFile" id="WeightFile" onchange="Copyfilenames(this.name); ">
|
||||||
|
|
||||||
|
<label id="WeightFileLabel" style="display:none;">
|
||||||
|
<a><span></span><small></small></a>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
@ -459,6 +472,9 @@
|
|||||||
var VehicleNoInput = modal.find('#Vehicle_No');
|
var VehicleNoInput = modal.find('#Vehicle_No');
|
||||||
var DriverInput = modal.find('#Driver_Name');
|
var DriverInput = modal.find('#Driver_Name');
|
||||||
var DriverMobileNumberInput = modal.find('#DriverMobileNumber');
|
var DriverMobileNumberInput = modal.find('#DriverMobileNumber');
|
||||||
|
var MasterFileInput = modal.find('#MasterFile');
|
||||||
|
modal.find('#MasterFileLabel').hide();
|
||||||
|
|
||||||
var depCode = "<?php echo $DEPCode; ?>";
|
var depCode = "<?php echo $DEPCode; ?>";
|
||||||
|
|
||||||
// depCode != "DEP27"
|
// depCode != "DEP27"
|
||||||
@ -491,6 +507,7 @@
|
|||||||
|
|
||||||
$("#tbleIGRAppend").empty();
|
$("#tbleIGRAppend").empty();
|
||||||
$('#content').loader('show');
|
$('#content').loader('show');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: { id: igr },
|
data: { id: igr },
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -498,13 +515,40 @@
|
|||||||
success: function(data) {
|
success: function(data) {
|
||||||
// success:function(data) {
|
// success:function(data) {
|
||||||
$('#content').loader('hide');
|
$('#content').loader('hide');
|
||||||
|
var parsedData = JSON.parse(data);
|
||||||
|
if (parsedData.length === 0) {
|
||||||
|
console.log("No data available");
|
||||||
|
// Reset all relevant fields and table
|
||||||
|
$('#IgrshowTitle').text('');
|
||||||
|
$("#IGRNO1").val('');
|
||||||
|
$("#txtIGRLineItem").val('');
|
||||||
|
$('#printLink').attr('href', '#');
|
||||||
|
$('.help-block').text('');
|
||||||
|
$("#Vehicle_No").val('');
|
||||||
|
$("#Driver_Name").val('');
|
||||||
|
$("#DriverMobileNumber").val('');
|
||||||
|
$("#IGRStatus").val('');
|
||||||
|
$("#PONo").val('');
|
||||||
|
$("#Supplier").val('');
|
||||||
|
$("#Add1").val('');
|
||||||
|
$("#Invoice_No").val('');
|
||||||
|
$("#Invoice_Date").val('');
|
||||||
|
$("#MaterialRcvdDate").val('');
|
||||||
|
$("#ser").val('');
|
||||||
|
$("#tbleIGRAppend").empty(); // Clear the table
|
||||||
|
// Hide the MasterFileLabel if no data
|
||||||
|
modal.find('#MasterFileLabel').hide();
|
||||||
|
|
||||||
|
return; // Exit the function early
|
||||||
|
}
|
||||||
|
|
||||||
var trIGRHTML = '';
|
var trIGRHTML = '';
|
||||||
$.each(JSON.parse(data), function(i, item) {
|
$.each(parsedData, function(i, item) {
|
||||||
if (igr == item.IGRNO) {
|
if (igr == item.IGRNO) {
|
||||||
console.log(item);
|
console.log(item);
|
||||||
$('#IgrshowTitle').text(" ( " + item.IGRNO + " ) ");
|
$('#IgrshowTitle').text(" ( " + item.IGRNO + " ) ");
|
||||||
$("#IGRNO1").val(item.IGRNO);
|
$("#IGRNO1").val(item.IGRNO);
|
||||||
$("#IGRItemNo").val(item.IGRItemNo);
|
$("#txtIGRLineItem").val(item.IGRItemNo);
|
||||||
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
||||||
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
|
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
|
||||||
$('#printLink').attr('href', newUrl);
|
$('#printLink').attr('href', newUrl);
|
||||||
@ -520,32 +564,31 @@
|
|||||||
$("#Supplier").val(item.SupplierName);
|
$("#Supplier").val(item.SupplierName);
|
||||||
$("#Add1").val(item.Address);
|
$("#Add1").val(item.Address);
|
||||||
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
|
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
|
||||||
// alert(item.DeliveryChellanDate);
|
console.log(typeof item.MasterFile);
|
||||||
|
modal.find('#MasterFileLabel').hide();
|
||||||
|
if (typeof item.MasterFile == 'string') {
|
||||||
|
if (item.MasterFile !== null && item.MasterFile !== undefined && item.MasterFile.trim() !== "") {
|
||||||
|
modal.find('#MasterFileLabel a').attr('href', '<?php echo base_url() ?>' + 'public/uploads/Igrfiles/' + item.MasterFile);
|
||||||
|
modal.find('#MasterFileLabel a').attr('title', 'previously uploaded IGR Master File');
|
||||||
|
modal.find('#MasterFileLabel a span').text('previously uploaded - ');
|
||||||
|
modal.find('#MasterFileLabel a small').text(item.MasterFile);
|
||||||
|
modal.find('#MasterFileLabel').show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
modal.find('#MasterFileLabel').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format dates
|
||||||
var dcd = new Date(item.DeliveryChellanDate);
|
var dcd = new Date(item.DeliveryChellanDate);
|
||||||
//alert(dcd.getDate()+ '.' + (dcd.getMonth() + 1)+ '.' + dcd.getFullYear());
|
|
||||||
// var dcd2 = (dcd.getDate() + '/' + (dcd.getMonth() + 1) + '/' + dcd.getFullYear());
|
|
||||||
var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear());
|
var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear());
|
||||||
$("#Invoice_Date").val(dcd2);
|
$("#Invoice_Date").val(dcd2);
|
||||||
if (item.MaterialRcvdDate === null) {
|
var Mat_rcv_date = (item.MaterialRcvdDate === null) ? ' ' : formatDate(new Date(item.MaterialRcvdDate));
|
||||||
var Mat_rcv_date = ' ';
|
|
||||||
} else {
|
|
||||||
var MR_dt = new Date(item.MaterialRcvdDate);
|
|
||||||
var Mat_rcv_date = (String(MR_dt.getDate()).padStart(2, '0') + '-' + (String(MR_dt.getMonth() + 1).padStart(2, '0')) + '-' + MR_dt.getFullYear());
|
|
||||||
}
|
|
||||||
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
||||||
if (item.GrossWeightDate === null) {
|
var gross_rcv_date = (item.GrossWeightDate === null) ? ' ' : formatDate(new Date(item.GrossWeightDate));
|
||||||
var gross_rcv_date = ' ';
|
|
||||||
} else {
|
|
||||||
var G_dt = new Date(item.GrossWeightDate);
|
|
||||||
var gross_rcv_date = formatDateTime(G_dt);
|
|
||||||
}
|
|
||||||
$("#ser").val(item.ServiceDescription);
|
$("#ser").val(item.ServiceDescription);
|
||||||
|
|
||||||
|
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
if (igrstatus === "ST074") {
|
if (igrstatus === "ST074") {
|
||||||
// alert("here");
|
|
||||||
// document.getElementById('pendingQuantityHeader').style.display = 'table-cell';
|
|
||||||
$("#pendingQuantityHeader").css("display", "table-cell");
|
$("#pendingQuantityHeader").css("display", "table-cell");
|
||||||
|
|
||||||
trIGRHTML += '<tr>' +
|
trIGRHTML += '<tr>' +
|
||||||
@ -558,12 +601,8 @@
|
|||||||
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + parseInt(item.Quantity - item.QuantityAsPerInvoice) + '</td>' +
|
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + parseInt(item.Quantity - item.QuantityAsPerInvoice) + '</td>' +
|
||||||
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
|
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
|
||||||
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
||||||
'<input type="hidden" id="IGRItemNo' + i + '" name="IGRItemNo' + i + '" value="' + item.IGRItemNo + '">' +
|
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
||||||
'<input type="text" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
|
||||||
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
||||||
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
|
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
|
||||||
'<input type="hidden" id="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
|
'<input type="hidden" id="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
|
||||||
@ -571,14 +610,15 @@
|
|||||||
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
|
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
|
||||||
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
|
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
|
||||||
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
||||||
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' + // Example with no initial value
|
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
|
||||||
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
||||||
|
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '" style="display:none;">' +
|
||||||
|
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
|
||||||
'</tr>';
|
'</tr>';
|
||||||
//alert(item.PendingQty);
|
|
||||||
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
|
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
|
||||||
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
|
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
|
||||||
}
|
}
|
||||||
// console.log("Ifpart ... ");
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$("#pendingQuantityHeader").css("display", "none");
|
$("#pendingQuantityHeader").css("display", "none");
|
||||||
@ -592,7 +632,6 @@
|
|||||||
'<td>' + item.Remarks + '</td>' +
|
'<td>' + item.Remarks + '</td>' +
|
||||||
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
||||||
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
||||||
'<input type="hidden" id="IGRItemNo' + i + '" name="IGRItemNo' + i + '" value="' + item.IGRItemNo + '">' +
|
|
||||||
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
||||||
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
||||||
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
|
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
|
||||||
@ -603,14 +642,13 @@
|
|||||||
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
||||||
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
|
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
|
||||||
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
||||||
|
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '">' +
|
||||||
|
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
|
||||||
'</tr>';
|
'</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//alert(item.QuantityAsPerInvoice);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#tbleIGRAppend").empty();
|
$("#tbleIGRAppend").empty();
|
||||||
$("#tbleIGRAppend").append(trIGRHTML);
|
$("#tbleIGRAppend").append(trIGRHTML);
|
||||||
}
|
}
|
||||||
@ -638,11 +676,6 @@
|
|||||||
$('#draftIGR').click(function(){
|
$('#draftIGR').click(function(){
|
||||||
$('#content').loader('show');
|
$('#content').loader('show');
|
||||||
var igrno = $("#IGRNO1").val();
|
var igrno = $("#IGRNO1").val();
|
||||||
var materialrcv_date = $("#MaterialRcvdDate").val();
|
|
||||||
var inv_date = $("#Invoice_Date").val();
|
|
||||||
var vehicle_no = $('#Vehicle_No').val();
|
|
||||||
var driver = $('#Driver_Name').val();
|
|
||||||
var driver_mobile = $('#DriverMobileNumber').val();
|
|
||||||
var status = 0;
|
var status = 0;
|
||||||
var tableData = [];
|
var tableData = [];
|
||||||
$('#tbleIGRAppend tr').each(function(index) {
|
$('#tbleIGRAppend tr').each(function(index) {
|
||||||
@ -657,15 +690,27 @@
|
|||||||
TareWeight: row.find('#txtTareWeight' + index).val(),
|
TareWeight: row.find('#txtTareWeight' + index).val(),
|
||||||
TareWeightDate: row.find('#txtTareWeightDate' + index).val(),
|
TareWeightDate: row.find('#txtTareWeightDate' + index).val(),
|
||||||
NetWeight: row.find('#txtNetWeight' + index).val(),
|
NetWeight: row.find('#txtNetWeight' + index).val(),
|
||||||
IGRItemNo: row.find('#txtIGRLineItem' + index).val()
|
IGRItemNo: row.find('#txtIGRLineItem' + index).val(),
|
||||||
|
WeightFile: row.find('#txtWeightFile' + index).val()
|
||||||
};
|
};
|
||||||
tableData.push(rowData);
|
tableData.push(rowData);
|
||||||
});
|
});
|
||||||
console.log(tableData);
|
var formData = new FormData();
|
||||||
|
formData.append('igr', igrno);
|
||||||
|
formData.append('mrc', $("#MaterialRcvdDate").val());
|
||||||
|
formData.append('invdate', $("#Invoice_Date").val());
|
||||||
|
formData.append('vehicle_no', $('#Vehicle_No').val());
|
||||||
|
formData.append('driver', $('#Driver_Name').val());
|
||||||
|
formData.append('driver_mobile', $('#DriverMobileNumber').val());
|
||||||
|
formData.append('status', status);
|
||||||
|
formData.append('tableData', JSON.stringify(tableData));
|
||||||
|
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date,vehicle_no:vehicle_no,driver:driver,driver_mobile:driver_mobile,status:status,tableData: tableData},
|
data: formData,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo base_url() ?>UpdateIGR",
|
url: "<?php echo base_url() ?>UpdateIGR",
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
success:function(data) {
|
success:function(data) {
|
||||||
$('#content').loader('hide');
|
$('#content').loader('hide');
|
||||||
alert(data);
|
alert(data);
|
||||||
@ -676,11 +721,6 @@ console.log(tableData);
|
|||||||
$('#generateIGR').click(function(){
|
$('#generateIGR').click(function(){
|
||||||
$('#content').loader('show');
|
$('#content').loader('show');
|
||||||
var igrno = $("#IGRNO1").val();
|
var igrno = $("#IGRNO1").val();
|
||||||
var materialrcv_date = $("#MaterialRcvdDate").val();
|
|
||||||
var inv_date = $("#Invoice_Date").val();
|
|
||||||
var vehicle_no = $('#Vehicle_No').val();
|
|
||||||
var driver = $('#Driver_Name').val();
|
|
||||||
var driver_mobile = $('#DriverMobileNumber').val();
|
|
||||||
var status = 1;
|
var status = 1;
|
||||||
var tableData = [];
|
var tableData = [];
|
||||||
$('#tbleIGRAppend tr').each(function(index) {
|
$('#tbleIGRAppend tr').each(function(index) {
|
||||||
@ -695,14 +735,28 @@ console.log(tableData);
|
|||||||
TareWeight: row.find('#txtTareWeight' + index).val(),
|
TareWeight: row.find('#txtTareWeight' + index).val(),
|
||||||
TareWeightDate: row.find('#txtTareWeightDate' + index).val(),
|
TareWeightDate: row.find('#txtTareWeightDate' + index).val(),
|
||||||
NetWeight: row.find('#txtNetWeight' + index).val(),
|
NetWeight: row.find('#txtNetWeight' + index).val(),
|
||||||
IGRItemNo: row.find('#txtIGRLineItem' + index).val()
|
IGRItemNo: row.find('#txtIGRLineItem' + index).val(),
|
||||||
|
WeightFile: row.find('#txtWeightFile' + index).val()
|
||||||
};
|
};
|
||||||
tableData.push(rowData);
|
tableData.push(rowData);
|
||||||
});
|
});
|
||||||
|
var formData = new FormData();
|
||||||
|
formData.append('igr', igrno);
|
||||||
|
formData.append('mrc', $("#MaterialRcvdDate").val());
|
||||||
|
formData.append('invdate', $("#Invoice_Date").val());
|
||||||
|
formData.append('vehicle_no', $('#Vehicle_No').val());
|
||||||
|
formData.append('driver', $('#Driver_Name').val());
|
||||||
|
formData.append('driver_mobile', $('#DriverMobileNumber').val());
|
||||||
|
formData.append('status', status);
|
||||||
|
formData.append('tableData', JSON.stringify(tableData));
|
||||||
|
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date,vehicle_no:vehicle_no,driver:driver,driver_mobile:driver_mobile,status:status,tableData: tableData},
|
data: formData,
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "<?php echo base_url() ?>UpdateIGR",
|
url: "<?php echo base_url() ?>UpdateIGR",
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
success:function(data) {
|
success:function(data) {
|
||||||
$('#content').loader('hide');
|
$('#content').loader('hide');
|
||||||
alert(data);
|
alert(data);
|
||||||
@ -997,9 +1051,10 @@ function deleteBill(Billno,i){
|
|||||||
$("#WeightCalculator").on("shown.bs.modal", function(e) {
|
$("#WeightCalculator").on("shown.bs.modal", function(e) {
|
||||||
var inx = $(e.relatedTarget).data('index');
|
var inx = $(e.relatedTarget).data('index');
|
||||||
var material = $(e.relatedTarget).data('material');
|
var material = $(e.relatedTarget).data('material');
|
||||||
|
var modal = $(this);
|
||||||
|
|
||||||
document.getElementById('WeightTitle').textContent = " ( "+material+" )";
|
|
||||||
|
|
||||||
|
$('#WeightTitle').text(" ( " + material + " )");
|
||||||
|
|
||||||
// Clear the modal inputs
|
// Clear the modal inputs
|
||||||
$("#GrossWeight").val('');
|
$("#GrossWeight").val('');
|
||||||
@ -1007,6 +1062,8 @@ function deleteBill(Billno,i){
|
|||||||
$("#TareWeight").val('');
|
$("#TareWeight").val('');
|
||||||
$("#TareWeightDate").val('');
|
$("#TareWeightDate").val('');
|
||||||
$("#NetWeight").val('');
|
$("#NetWeight").val('');
|
||||||
|
$("#WeightFile").val('');
|
||||||
|
|
||||||
|
|
||||||
// Retrieve values from hidden inputs
|
// Retrieve values from hidden inputs
|
||||||
var v1 = $("#txtGrossWeight" + inx).val();
|
var v1 = $("#txtGrossWeight" + inx).val();
|
||||||
@ -1014,14 +1071,18 @@ function deleteBill(Billno,i){
|
|||||||
var v3 = $("#txtTareWeight" + inx).val();
|
var v3 = $("#txtTareWeight" + inx).val();
|
||||||
var v4 = $("#txtTareWeightDate" + inx).val();
|
var v4 = $("#txtTareWeightDate" + inx).val();
|
||||||
var v5 = $("#txtNetWeight" + inx).val();
|
var v5 = $("#txtNetWeight" + inx).val();
|
||||||
|
var fileInput = $("#txtWeightFile" + inx)[0];
|
||||||
|
var fileName = $("#txtWeightFileName" + inx).val();
|
||||||
// Debugging alerts
|
modal.find('#WeightFileLabel').hide();
|
||||||
// console.log("v1:", v1);
|
console.log(typeof fileName);
|
||||||
// console.log("v2:", v2);
|
if (fileName !== 'null' && fileName !== undefined && fileName.trim() !== "") {
|
||||||
// console.log("v3:", v3);
|
modal.find('#WeightFileLabel a').attr('title', 'previously uploaded IGR Weight File');
|
||||||
// console.log("v4:", v4);
|
modal.find('#WeightFileLabel a').attr('href', '<?php echo base_url() ?>'+'public/uploads/Igrfiles/'+fileName);
|
||||||
// console.log("v5:", v5);
|
modal.find('#WeightFileLabel a span').text('previously uploaded - ');
|
||||||
|
modal.find('#WeightFileLabel a small').text(fileName);
|
||||||
|
modal.find('#WeightFileLabel').show();
|
||||||
|
}
|
||||||
|
console.log(fileInput);
|
||||||
console.log("Selected values for index:", typeof inx,inx);
|
console.log("Selected values for index:", typeof inx,inx);
|
||||||
|
|
||||||
// Set modal inputs with the retrieved values
|
// Set modal inputs with the retrieved values
|
||||||
@ -1031,6 +1092,22 @@ function deleteBill(Billno,i){
|
|||||||
$("#TareWeightDate").val(v4);
|
$("#TareWeightDate").val(v4);
|
||||||
$("#NetWeight").val(v5);
|
$("#NetWeight").val(v5);
|
||||||
$("#CurrentInx").val(inx);
|
$("#CurrentInx").val(inx);
|
||||||
|
|
||||||
|
fileName
|
||||||
|
if (fileInput && fileInput.files.length > 0) {
|
||||||
|
var targetInput = $("#WeightFile")[0];
|
||||||
|
var file = fileInput.files[0];
|
||||||
|
|
||||||
|
// Create a new DataTransfer object
|
||||||
|
var dataTransfer = new DataTransfer();
|
||||||
|
dataTransfer.items.add(file);
|
||||||
|
|
||||||
|
// Set the file to the target input
|
||||||
|
targetInput.files = dataTransfer.files;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log("No file selected or file input not found.");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -1040,31 +1117,57 @@ function deleteBill(Billno,i){
|
|||||||
var v3 = $("#TareWeight").val();
|
var v3 = $("#TareWeight").val();
|
||||||
var v4 = $("#TareWeightDate").val();
|
var v4 = $("#TareWeightDate").val();
|
||||||
var v5 = $("#NetWeight").val();
|
var v5 = $("#NetWeight").val();
|
||||||
var v6 = $("#CurrentInx").val();
|
var inx = $("#CurrentInx").val();
|
||||||
var IGRNO1 = $("#IGRNO1").val();
|
var IGRNO1 = $("#IGRNO1").val();
|
||||||
|
var fileInput = $("#WeightFile")[0]; // Get the file input element
|
||||||
|
|
||||||
// Debugging alerts
|
if (inx !== undefined && inx !== '') {
|
||||||
// console.log("v1:", v1);
|
console.log("Saving values for index:", inx);
|
||||||
// console.log("v2:", v2);
|
|
||||||
// console.log("v3:", v3);
|
|
||||||
// console.log("v4:", v4);
|
|
||||||
// console.log("v5:", v5);
|
|
||||||
if (v6 !== undefined && v6 !== '') {
|
|
||||||
console.log("Saving values for index:", v6);
|
|
||||||
|
|
||||||
// Set the values back to the hidden inputs
|
// Set the values back to the hidden inputs
|
||||||
$("#txtGrossWeight" + v6).val(v1);
|
$("#txtGrossWeight" + inx).val(v1);
|
||||||
$("#txtGrossWeightDate" + v6).val(v2);
|
$("#txtGrossWeightDate" + inx).val(v2);
|
||||||
$("#txtTareWeight" + v6).val(v3);
|
$("#txtTareWeight" + inx).val(v3);
|
||||||
$("#txtTareWeightDate" + v6).val(v4);
|
$("#txtTareWeightDate" + inx).val(v4);
|
||||||
$("#txtNetWeight" + v6).val(v5);
|
$("#txtNetWeight" + inx).val(v5);
|
||||||
var txtIGRLineItem = $("#txtIGRLineItem" + v6).val();
|
var txtIGRLineItem = $("#txtIGRLineItem" + inx).val();
|
||||||
|
|
||||||
|
// Prepare FormData
|
||||||
|
var formData = new FormData();
|
||||||
|
formData.append('GrossWeight', v1);
|
||||||
|
formData.append('GrossWeightDate', v2);
|
||||||
|
formData.append('TareWeight', v3);
|
||||||
|
formData.append('TareWeightDate', v4);
|
||||||
|
formData.append('NetWeight', v5);
|
||||||
|
formData.append('IGR', IGRNO1);
|
||||||
|
formData.append('IGRlineitem', txtIGRLineItem);
|
||||||
|
if (fileInput && fileInput.files.length > 0) {
|
||||||
|
var file = fileInput.files[0];
|
||||||
|
formData.append('WeightFile', file);
|
||||||
|
} else {
|
||||||
|
console.log("No file selected or file input not found.");
|
||||||
|
}
|
||||||
|
// if (fileInput && fileInput.files.length > 0) {
|
||||||
|
// var targetInput = $("#txtWeightFile" + inx)[0];
|
||||||
|
// var file = fileInput.files[0];
|
||||||
|
|
||||||
|
// // Create a new DataTransfer object
|
||||||
|
// var dataTransfer = new DataTransfer();
|
||||||
|
// dataTransfer.items.add(file);
|
||||||
|
|
||||||
|
// // Set the file to the target input
|
||||||
|
// targetInput.files = dataTransfer.files;
|
||||||
|
// formData.append('WeightFile', file);
|
||||||
|
|
||||||
|
// } else {
|
||||||
|
// console.log("No file selected or file input not found.");
|
||||||
|
// }
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data:{GrossWeight:v1,GrossWeightDate:v2,TareWeight:v3,TareWeightDate:v4,NetWeight:v5,IGR:IGRNO1,IGRlineitem:txtIGRLineItem},
|
|
||||||
//dataType:"json",
|
|
||||||
type:"POST",
|
|
||||||
url: "<?php echo base_url() ?>updateIGRWeight",
|
url: "<?php echo base_url() ?>updateIGRWeight",
|
||||||
|
type: "POST",
|
||||||
|
data: formData,
|
||||||
|
contentType: false, // Don't set content type header
|
||||||
|
processData: false,
|
||||||
success:function(data) {
|
success:function(data) {
|
||||||
if(data)
|
if(data)
|
||||||
{
|
{
|
||||||
@ -1079,11 +1182,12 @@ function deleteBill(Billno,i){
|
|||||||
$("#TareWeight").val('');
|
$("#TareWeight").val('');
|
||||||
$("#TareWeightDate").val('');
|
$("#TareWeightDate").val('');
|
||||||
$("#NetWeight").val('');
|
$("#NetWeight").val('');
|
||||||
|
$("#WeightFile").val('');
|
||||||
|
|
||||||
// Close the modal
|
// Close the modal
|
||||||
$("#WeightCalculator").modal('hide');
|
$("#WeightCalculator").modal('hide');
|
||||||
} else {
|
} else {
|
||||||
console.log("Saving values for index: "+v6+" undefined");
|
console.log("Saving values for index: "+inx+" undefined");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1260,7 +1364,14 @@ function deleteBill(Billno,i){
|
|||||||
'</tr>';
|
'</tr>';
|
||||||
$('#tblefile').append(newRow);
|
$('#tblefile').append(newRow);
|
||||||
}
|
}
|
||||||
|
function Copyfilenames(id) {
|
||||||
|
var size = $('input[name=' + id + ']')[0].files[0].size;
|
||||||
|
if (size > 2100000) {
|
||||||
|
alert('Sorry Your File is Large To 2MB');
|
||||||
|
} else {
|
||||||
|
var name = $('input[name=' + id + ']')[0].files[0].name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!-- Latest DataTables JS -->
|
<!-- Latest DataTables JS -->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user