Code merge : GWM

This commit is contained in:
Smart 2024-10-25 09:09:01 +05:30
parent 2a9014449a
commit 15d09e5c7b
4 changed files with 860 additions and 871 deletions

View File

@ -237,7 +237,7 @@ class Ipinvoice_model extends Model
->join('ip_invoice_items b', 'a.invoice_id = b.invoice_id', 'left')
->join('ip_invoice_item_amounts c', 'b.item_id = c.item_id', 'left')
->where('a.invoice_date_created', date('Y-m-d'))
->where('a.invoice_status_id', 2);
->whereIn('a.invoice_status_id', [2,5]);
$query = $builder->get();
return $query->getRow(); // Assuming you want a single row of aggregated results
@ -270,7 +270,7 @@ class Ipinvoice_model extends Model
->join('ip_invoice_items b', 'a.invoice_id = b.invoice_id', 'left')
->join('ip_invoice_item_amounts c', 'b.item_id = c.item_id', 'left')
->where('a.invoice_date_created >=', $fiscalMonthStart)
->where('a.invoice_status_id', 2);
->whereIn('a.invoice_status_id', [2,5]);
// Execute the query
$query = $builder->get();
@ -308,7 +308,7 @@ class Ipinvoice_model extends Model
->join('ip_invoice_items b', 'a.invoice_id = b.invoice_id', 'left')
->join('ip_invoice_item_amounts c', 'b.item_id = c.item_id', 'left')
->where('a.invoice_date_created >=', $fiscalYearStart)
->where('a.invoice_status_id', 2);
->whereIn('a.invoice_status_id', [2,5]);
// Execute the query
$query = $builder->get();

View File

@ -164,6 +164,27 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
.modal {
padding-right: 30% ! important;
}
/* #drierTable th:nth-child(1),
#drierTable th:nth-child(2),
#drierTable td:nth-child(1),
#drierTable td:nth-child(2) {
position: sticky;
left: 0;
background-color: white;
z-index: 2;
border-right: 1px solid #ddd;
}
#drierTable th:nth-child(1),
#drierTable td:nth-child(1) {
z-index: 3;
} */
</style>
<div class="content-page">
<div class="content">

View File

@ -36,7 +36,10 @@ $(function() {
$("#Date").datepicker({
// minDate : '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'
});
@ -47,8 +50,8 @@ $(function() {
.num {
text-align: left;
}
.select2
{
.select2 {
width: 100% ! important;
}
</style>
@ -161,7 +164,9 @@ $(function() {
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Add Line Item </h4></center>
<center>
<h4>Add Line Item </h4>
</center>
</div>
<div align="left">
@ -231,7 +236,9 @@ $(function() {
</div>
<div class="modal-footer">
<a class="btn btn-info font addClick" ID="addClick" ><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Add</span></a>
<a class="btn btn-info font addClick" ID="addClick"><i
class="fa fa-plus"></i>&nbsp;&nbsp;<span
class="bold">Add</span></a>
<a class="btn btn-info" data-dismiss="modal" value="Cancel">cancel</a>
</div>
</div>
@ -248,7 +255,9 @@ $(function() {
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Edit Line Item </h4></center>
<center>
<h4>Edit Line Item </h4>
</center>
</div>
<div align="left">
@ -306,7 +315,9 @@ $(function() {
</div>
<div class="modal-footer">
<a class="btn btn-info font EditItem" ID="EditItem" ><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Edit</span></a>
<a class="btn btn-info font EditItem" ID="EditItem"><i
class="fa fa-plus"></i>&nbsp;&nbsp;<span
class="bold">Edit</span></a>
<a class="btn btn-info" data-dismiss="modal" value="Cancel">cancel</a>
</div>
</div>
@ -328,7 +339,9 @@ $(function() {
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>View Line Item </h4></center>
<center>
<h4>View Line Item </h4>
</center>
</div>
<div align="left">
@ -400,7 +413,8 @@ $(function() {
</div>
<div class="row" style="padding: 0px 15px 0px 10px;">
<table id="mytable" class="table table-bordered table-hover editableTable" style="background-color:#fff;font-size:12px;">
<table id="mytable" class="table table-bordered table-hover editableTable"
style="background-color:#fff;font-size:12px;">
<thead>
<th>SNO</th>
<th>Item Code</th>
@ -448,12 +462,23 @@ $(function() {
<td>
<a data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" data-target='#EditItem' data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <?php echo $record->MaterialCode ; ?> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a onclick = "RemoveList(<?php echo $index ; ?>)" class="link" data-id="<?php echo $record->MaterialCode ; ?>" data-userid="<?php echo $index ; ?>" id="Del"><span class="glyphicon glyphicon-trash"></span></a></td>
<a data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>"
data-target='#EditItem' data-toggle="modal" href="#EditItem"><i
class="fa fa-pencil" data-toggle="tooltip"
title="Click here to view/Edit the <?php echo $record->MaterialCode ; ?> Material details"></i>&nbsp;&nbsp;&nbsp;</a>
<a onclick="RemoveList(<?php echo $index ; ?>)" class="link"
data-id="<?php echo $record->MaterialCode ; ?>"
data-userid="<?php echo $index ; ?>" id="Del"><span
class="glyphicon glyphicon-trash"></span></a>
</td>
<?php
}else {?>
<td>
<a data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" data-target='#ViewItem' data-toggle="modal" href="#ViewItem"><i class="fa fa-eye" data-toggle="tooltip" title="Click here to view the <?php echo $record->MaterialCode ; ?> Material details"></i>&nbsp;&nbsp;&nbsp;</a>
<a data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>"
data-target='#ViewItem' data-toggle="modal" href="#ViewItem"><i class="fa fa-eye"
data-toggle="tooltip"
title="Click here to view the <?php echo $record->MaterialCode ; ?> Material details"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
<?php
}?>
@ -481,8 +506,10 @@ $(function() {
<?php if($StatusCode == STORE_DRAFT)
{ ?>
<a class="btn btn-success Save" ID="Save" onclick="Save(0)" >&nbsp;&nbsp;<span class="bold">Save</span></a>
<a class="btn btn-success submit" ID="submit" onclick="Save(1)" >&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-success Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span
class="bold">Save</span></a>
<a class="btn btn-success submit" ID="submit" onclick="Save(1)">&nbsp;&nbsp;<span
class="bold">Submit</span></a>
<input type="reset" class="btn btn-success">
<?php }
@ -490,13 +517,15 @@ $(function() {
{?>
<!--<a class="btn btn-success" ID="update" onclick="update()" >&nbsp;&nbsp;<span class="bold">Update</span></a>
<a class="btn btn-success" href="<?php echo base_url(); ?>Requisition" ID="cancel">&nbsp;&nbsp;<span class="bold">Cancel</span></a> -->
<a class="btn btn-success Save" ID="submit" onclick="Save(1)" >&nbsp;&nbsp;<span class="bold">Update</span></a>
<a class="btn btn-success Save" ID="submit" onclick="Save(1)">&nbsp;&nbsp;<span
class="bold">Update</span></a>
<?php }
elseif (($StatusCode==STORE_APPROVAL)||($StatusCode==STORE_REJECT))
{?>
<a class="btn btn-success Save" ID="submit" onclick="Redirect()" >&nbsp;&nbsp;<span class="bold">OK</span></a>
<a class="btn btn-success Save" ID="submit" onclick="Redirect()">&nbsp;&nbsp;<span
class="bold">OK</span></a>
<?php }?>
@ -523,12 +552,11 @@ elseif (($StatusCode==STORE_APPROVAL)||($StatusCode==STORE_REJECT))
<td align="left"><%=Remarks%></td>
<td>
<a data-target='#EditItem' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=MaterialCode%> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick = "RemoveList(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
<a data-target='#EditItem' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EditItem"><i
class="fa fa-pencil" data-toggle="tooltip"
title="Click here to view/Edit the <%=MaterialCode%> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a
href='#' onclick="RemoveList(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>"
id="Del"><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
@ -542,18 +570,16 @@ elseif (($StatusCode==STORE_APPROVAL)||($StatusCode==STORE_REJECT))
<!--copy script-->
<script>
var isExceed = 0;
function isNumberKey(evt)
{
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
if (charCode != 46 && charCode > 31 &&
(charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<script>
$(function() {
var j = 0;
var ReqLineItem = <?php echo json_encode($LineItem, JSON_PRETTY_PRINT) ?>;
@ -584,12 +610,13 @@ $(function() {
}).appendTo('form');
});
$( ".datePicker" ).datepicker({ dateFormat: 'dd/mm/yy' });
$(".datePicker").datepicker({
dateFormat: 'dd/mm/yy'
});
//Initialize Select2 Elements
});
</script>
<script>
$('#CostCenter').change(function() {
var id = $('#CostCenter').val();
@ -598,8 +625,7 @@ var id = $('#CostCenter').val();
$.each(y, function(idx, obj) {
// alert(obj.PONO);
if(id == obj.CostCenterCode)
{
if (id == obj.CostCenterCode) {
//alert(obj.BudgetAmount);
$("#BudgetAmount").val(obj.BudgetAmount);
@ -610,10 +636,6 @@ var id = $('#CostCenter').val();
});
</script>
<script>
$('#MaterialCode').change(function() {
var id = $('#MaterialCode').val();
@ -631,24 +653,21 @@ $("#UOM").val('');
}
});
});
</script>
<script>
function addHidden(theForm, key, value) {
// Create a hidden input element, and append it to the form:
var input = document.createElement('input');
input.type = 'hidden';
input.name = key;'name-as-seen-at-the-server';
input.id = key;'name-as-seen-at-the-server';
input.name = key;
'name-as-seen-at-the-server';
input.id = key;
'name-as-seen-at-the-server';
input.value = value;
theForm.append(input);
}
$("#mypo").on("shown.bs.modal", function(e) {
if($("option:selected", $("#CostCenter")).val() == '-1')
{
if ($("option:selected", $("#CostCenter")).val() == '-1') {
alert('Please select the CostCenter ');
e.close();
}
@ -656,17 +675,14 @@ $("#mypo").on("shown.bs.modal", function(e) {
var index = <?php echo $index; ?>;
$('.addClick').click(function()
{
$('.addClick').click(function() {
if ($("#MaterialCode option:selected").val() =='-1' )
{
if ($("#MaterialCode option:selected").val() == '-1') {
alert('Please Select the MaterialCode ');
return false;
}
if(document.getElementById('Quantity').value == '' )
{
if (document.getElementById('Quantity').value == '') {
alert('Please Enter the Quantity');
return false;
@ -691,7 +707,15 @@ $("#mypo").on("shown.bs.modal", function(e) {
var template = jQuery("#tempList").html();
$('#mytab').append(_.template(template,{index:temp,MaterialCode:MaterialCode,MaterialName:Description,UOM:UOM,Quantity:Quantity,Remarks:Remarks,IssuedQty:IssuedQty}));
$('#mytab').append(_.template(template, {
index: temp,
MaterialCode: MaterialCode,
MaterialName: Description,
UOM: UOM,
Quantity: Quantity,
Remarks: Remarks,
IssuedQty: IssuedQty
}));
var theForm = $(".requistion");
@ -712,8 +736,7 @@ $("#mypo").on("shown.bs.modal", function(e) {
});
function clear()
{
function clear() {
$('#MaterialCode').val('');
$('#Description').val('');
$('#UOM').val('');
@ -723,14 +746,12 @@ function clear()
}
var userid = '';
function removeHiddenRows(rowcount)
{
function removeHiddenRows(rowcount) {
var step;
if(rowcount > 2)
{
for (step = 1; step < rowcount ; step++)
{
if (rowcount > 2) {
for (step = 1; step < rowcount; step++) {
var td = document.getElementById(step);
td.parentNode.removeChild(td);
$("#MaterialCode" + step).remove();
@ -801,8 +822,7 @@ $('.EditItem').click(function(){
$('#txtRowCount').val(userid);
});
function Deleterow(rowid)
{
function Deleterow(rowid) {
@ -814,19 +834,16 @@ function Deleterow(rowid)
id[0] = $('#txtReqNo').val();
id[1] = MaterialCode;
var answer = confirm(" Do you want to delete the Item from the List?")
if (answer)
{
if (answer) {
// To delete the item from list
var x = <?php echo json_encode($LineItem, JSON_PRETTY_PRINT) ?>;
var result = '0';
//alert(x);
//alert(MaterialCode);
if(MaterialCode != "0")
{
if (MaterialCode != "0") {
$.each(x, function(idx, obj) {
if(obj.MaterialCode === MaterialCode)
{
if (obj.MaterialCode === MaterialCode) {
result = '1';
return false;
}
@ -835,64 +852,55 @@ function Deleterow(rowid)
}
if(result == '0')
{
if (result == '0') {
var DelRows = $('#txtDeletedRow').val();
tr.parentNode.removeChild(tr);
if(DelRows != '')
{
if (DelRows != '') {
DelRows = DelRows + ":" + rowid;
}
else
{
} else {
DelRows = "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
}
// To delete the value from Tables
else if(result == '1')
{
else if (result == '1') {
var DelRows = $('#txtDeletedRow').val();
tr.parentNode.removeChild(tr);
if(DelRows != '')
{
if (DelRows != '') {
DelRows = DelRows + ":" + rowid;
}
else
{
} else {
DelRows = "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
$('#loader').show();
$.ajax({
data:{id:id},
data: {
id: id
},
type: "POST",
url: "<?php echo base_url() ?>storerequisitionlist/DeleteRequistionForm",
success: function(data) {
if(data)
{
if (data) {
$('#loader').hide();
alert(data);
}
else
{
} else {
$('#loader').hide();
alert("Error");
}
}});
}
});
}
}
}
// this function used to remove the item from listing table
function RemoveList(rowid)
{
function RemoveList(rowid) {
var id = [];
@ -903,19 +911,16 @@ function Deleterow(rowid)
id[0] = $('#txtReqNo').val();
id[1] = MaterialCode;
var answer = confirm(" Do you want to delete the Item from the List?")
if (answer)
{
if (answer) {
// To delete the item from list
var x = <?php echo json_encode($LineItem, JSON_PRETTY_PRINT) ?>;
var result = '0';
//alert(x);
//alert(MaterialCode);
if(MaterialCode != "0")
{
if (MaterialCode != "0") {
$.each(x, function(idx, obj) {
if(obj.MaterialCode === MaterialCode)
{
if (obj.MaterialCode === MaterialCode) {
result = '1';
return false;
}
@ -924,108 +929,86 @@ function Deleterow(rowid)
}
if(result == '0')
{
if (result == '0') {
var DelRows = $('#txtDeletedRow').val();
tr.parentNode.removeChild(tr);
if(DelRows != '')
{
if (DelRows != '') {
DelRows = DelRows + ":" + rowid;
}
else
{
} else {
DelRows = "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
}
// To delete the value from Tables
else if(result == '1')
{
else if (result == '1') {
$('#content').loader('show');
var DelRows = $('#txtDeletedRow').val();
tr.parentNode.removeChild(tr);
if(DelRows != '')
{
if (DelRows != '') {
DelRows = DelRows + ":" + rowid;
}
else
{
} else {
DelRows = "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
$('#loader').show();
$.ajax({
data:{id:id},
data: {
id: id
},
type: "POST",
url: "<?php echo base_url() ?>storerequisitionlist/DeleteRequistionForm",
success: function(data) {
if(data)
{
if (data) {
$('#loader').hide();
alert(data);
}
else
{
} else {
$('#loader').hide();
alert("Error");
}
}});
}
});
}
}
}
function validateBeforeAdd()
{
function validateBeforeAdd() {
if ($("#CostCenter option:selected").val() =='-1' )
{
if ($("#CostCenter option:selected").val() == '-1') {
alert('Please Select the CostCenterCode ');
$("#CostCenter").focus();
return false;
}
else if( isExceed == '1')
{
} else if (isExceed == '1') {
alert('You dont have available Budget Amount. You cant raise new StoreRequisition');
return false;
}
else
{
} else {
$('#mypo').modal('show');
}
}
function Redirect()
{
function Redirect() {
window.location = "storerequisition";
}
function Save(status)
{
function Save(status) {
//alert($(json.stringify(MaterialCode).val());
var txtRowCount = $('#txtRowCount').val();
//var mat = $('#MaterialCode'+txtRowCount).val();
if(status == '0')
{
if (status == '0') {
stat = '<?php echo STORE_DRAFT; ?>';
}
else
{
} else {
stat = '<?php echo STORE_PENDINGAPPROVAL; ?>';
}
@ -1040,17 +1023,12 @@ else
var splitDepCode = $('#DepartmentName').val();
DEPCode = splitDepCode.split('-')[0];
if (validate())
{
if(document.getElementById('mytable').rows.length < 0)
{
if (validate()) {
if (document.getElementById('mytable').rows.length < 0) {
alert('Please Select Line item to Store Requisition');
$('#Deliverydt').focus();
return false;
}
else
{
} else {
console.log($('.requistion').serialize());
$('#loader').show();
@ -1060,8 +1038,7 @@ else
url: "<?php echo base_url() ?>storerequisitionlist/UpdateStoreRequistion",
success: function(data) {
if(data)
{
if (data) {
$('#loader').hide();
alert(data);
$('#txtRowCount').val('');
@ -1069,9 +1046,7 @@ else
window.location = "storerequisition";
}
else
{
} else {
$('#loader').hide();
alert("Error");
@ -1084,33 +1059,22 @@ else
}
}
}
function validate()
{
if($("option:selected", $("#CostCenter")).val() == '-1')
{
function validate() {
if ($("option:selected", $("#CostCenter")).val() == '-1') {
alert('Please Select CostCenter');
return false;
}
else if($("option:selected", $("#MaterialCode")).val() == '-1')
{
} else if ($("option:selected", $("#MaterialCode")).val() == '-1') {
alert('Please Select MaterialCode');
return false;
}
else if(document.getElementById('mytable').rows.length < 1)
{
} else if (document.getElementById('mytable').rows.length < 1) {
alert('Please Add Line Item');
return false;
}
else if(isExceed == 1)
{
} else if (isExceed == 1) {
alert('You dont have Budget and You cant Raise New StoreRequisition');
return false;
}
else
{
} else {
return true;
}
@ -1118,8 +1082,6 @@ function validate()
</script>
<script>
$(function() {
$('#Items').DataTable({
@ -1132,5 +1094,7 @@ function validate()
});
});
</script>

View File

@ -76,6 +76,10 @@
<link href="<?php echo base_url(); ?>public/new_assets/libs/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css" />
<style>
.dropdown-menu{
box-shadow: 0px 10px 43px 0 rgb(76 76 76 / 39%);
z-index: 20;
}
.mce-edit-area.mce-container.mce-panel.mce-first.mce-last.mce-stack-layout-item {
border-width: 0px 0px 0px !important;
}