296 lines
9.3 KiB
PHP
Executable File
296 lines
9.3 KiB
PHP
Executable File
<script>
|
|
$(function() {
|
|
//Initialize Select2 Elements
|
|
$("#PurchaseOrderNumber").select2();
|
|
|
|
});
|
|
</script>
|
|
<style>
|
|
.content {
|
|
Padding:0% ! important;
|
|
}
|
|
|
|
.num{
|
|
text-align:right;
|
|
}
|
|
</style>
|
|
<div class="content-wrapper" style="min-height:537">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
|
|
<h1>
|
|
<center>Siddharth Industries - Advance Request</center>
|
|
|
|
</h1>
|
|
</section>
|
|
<section class="content">
|
|
<div id="content"></div>
|
|
<?php
|
|
$attributes = array('class' => 'form-label-left advancerequest','name' => 'advancerequest','id' => 'advancerequest');
|
|
|
|
echo form_open($this->config->base_url().'purchaseorder/addadvancerequest',$attributes);
|
|
|
|
|
|
|
|
?>
|
|
<div class="row" style="padding:0% 2%">
|
|
<div class="col-md-12" >
|
|
<div class="col-md-3">
|
|
<label>Purchase Order Number</label>
|
|
<?php
|
|
|
|
$options = array("0"=>'Purchase Order Number');
|
|
|
|
if(!empty($PONO))
|
|
{
|
|
foreach ($PONO as $PO):
|
|
$options[$PO->PONO] =$PO->PONO;
|
|
endforeach;
|
|
}
|
|
|
|
|
|
|
|
|
|
echo form_dropdown('PONO', $options,set_value('PONO'),'id="PurchaseOrderNumber"' ,'class="form-control select2"' , 'required="true"' );
|
|
?>
|
|
</div>
|
|
|
|
<div class="col-md-2">
|
|
<label>Purchase Order Type</label>
|
|
<?php
|
|
$data = array('name' => 'PurchaseOrderType','value' => set_value('PurchaseOrderType'), 'id'=>'PurchaseOrderType' ,'class' => 'form-control' ,'required' => 'true' ,'readonly'=>'true');
|
|
|
|
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-2">
|
|
<label>PO Created Date</label>
|
|
<?php
|
|
$data = array('name' => 'PoCreatedDate','value' => set_value('PoCreatedDate'),'id'=>'PoCreatedDate' ,'class' => 'form-control num' ,'required' => 'true' , 'readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-2">
|
|
<label>Released On</label>
|
|
<?php
|
|
$data = array('name' => 'ReleasedOn','value' => set_value('ReleasedOn'),'id'=>'ReleasedOn' ,'class' => 'form-control num' ,'required' => 'true' , 'readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label id=labeltotal>Total Order Value In INR</label>
|
|
<div class="form-group">
|
|
|
|
<?php
|
|
$data = array('name' => 'TotalOrderValue','value' => set_value('TotalOrderValue'),'id'=>'TotalOrderValue' ,'class' => 'form-control num' ,'required' => 'true' , 'readonly'=>'true','onchange'=>'advanceamountCalculation()');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
<label for="selectmonth">Department</label>
|
|
<?php
|
|
$data = array('name' => 'Department','value' => set_value('Department'),'id'=>'Department', 'class' => 'form-control num' ,'required' => 'true' , 'readonly'=>'true','style'=>'text-align:left;');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Cost Center Code</label>
|
|
<div class="form-group">
|
|
|
|
<?php
|
|
$data = array('name' => 'CostCenterCode','value' => set_value('CostCenterCode'),'id'=>'CostCenterCode' ,'class' => 'form-control num' ,'required' => 'true' , 'readonly'=>'true','style'=>'text-align:right;');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Supplier Name</label>
|
|
<?php
|
|
$data = array('name' => 'SupplierName','value' => set_value('SupplierName'),'id'=>'SupplierName', 'class' => 'form-control' ,'required' => 'true' , 'readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-3">
|
|
<label for="selectmonth">Delivery Date/Schedule</label>
|
|
<?php
|
|
$data = array('name' => 'DeliveryDate','value' => set_value('DeliveryDate'),'id'=>'DeliveryDate' ,'class' => 'form-control num' ,'required' => 'true' , 'readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<legend>Payment Details</legend>
|
|
<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
<label for="payablefrom">Payment Terms</label>
|
|
<?php
|
|
$data = array('name' => 'PaymenyTerms','value' => set_value('PaymentTerms'),'id'=>'PaymenyTerms' , 'class' => 'form-control' ,'readonly' => 'true' );
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-md-3">
|
|
<label for="payablefrom">Advance In %</label>
|
|
<?php
|
|
$data = array('name' => 'AdvanceIn','value' => set_value('Advance In'),'id'=>'AdvanceIn' ,'class' => 'form-control','onchange'=>'advanceamountCalculation()','required' => 'true','style'=>'text-align:right;' );
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-3">
|
|
<label for="selectmonth" id=labeladv>Advance Amount In INR</label>
|
|
<?php
|
|
$data = array('name' => 'AdvanceAmount','value' => set_value('AdvanceAmount'),'id'=>'AdvanceAmount', 'class' => 'form-control num' ,'required' => 'true','readonly'=>'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="selectmonth">Remarks</label>
|
|
<?php
|
|
$data = array('name' => 'Remarks','value' => set_value('Remarks'),'id'=>'Remarks' ,'class' => 'form-control num' ,'required' => 'true','style'=>'text-align:left;');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12" align = "right"><br/>
|
|
<input type="Submit" class="btn btn-primary" value="Raise Request" style="margin-right:28px" onclick="validate();" />
|
|
</div>
|
|
|
|
</section>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$('#PurchaseOrderNumber').change(function(){
|
|
var PONUM=$('#PurchaseOrderNumber').val();
|
|
|
|
if(PONUM!='0')
|
|
{
|
|
|
|
var det=<?php echo json_encode($PONO, JSON_PRETTY_PRINT) ;?>;
|
|
$.each(det,function(idx, obj)
|
|
{
|
|
if(obj.PONO === PONUM)
|
|
{
|
|
|
|
$('#PurchaseOrderType').val(obj.POType);
|
|
var credt=obj.CreatedDate;
|
|
credt=credt.split(' ')[0]
|
|
$('#PoCreatedDate').val(credt);
|
|
var reldt=obj.ReleasedOn;
|
|
reldt=reldt.split(' ')[0];
|
|
|
|
$('#ReleasedOn').val(reldt);
|
|
$('#TotalOrderValue').val(obj.TotalOrderValue);
|
|
$('#PaymenyTerms').val(obj.PaymentTerms);
|
|
$('#Department').val(obj.DepartmentName);
|
|
$('#CostCenterCode').val(obj.CostCenterCode);
|
|
$('#SupplierName').val(obj.SupplierName);
|
|
$('#AdvanceIn').val(obj.AdvancePercentage);
|
|
$('#AdvanceAmount').val(obj.AdvanceAmount);
|
|
$('#Remarks').val(obj.Remarks);
|
|
|
|
|
|
var currency=obj.CurrencyType;
|
|
|
|
var deloption=obj.DeliveryOption;
|
|
|
|
if(deloption==1)
|
|
{
|
|
|
|
$('#DeliveryDate').val(obj.DeliverySchedule);
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
|
|
|
|
if(obj.POType=='IMPORT' || obj.POType=='CAPITAL')
|
|
{
|
|
|
|
$('#DeliveryDate').val(obj.Import_DispatchDetails);
|
|
}
|
|
|
|
else
|
|
{
|
|
var deldt=obj.DeliveryDate;
|
|
deldt=deldt.split(' ')[0];
|
|
|
|
$('#DeliveryDate').val(deldt);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
document.getElementById("labeltotal").innerHTML ='Total Order Value In '+currency;
|
|
document.getElementById("labeladv").innerHTML ='Advance Amount In '+currency;
|
|
advanceamountCalculation();
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
function advanceamountCalculation()
|
|
{
|
|
var advpercentage=parseFloat($('#AdvanceIn').val());
|
|
var totalamount=parseFloat($('#TotalOrderValue').val());
|
|
var amount=0;
|
|
amount=totalamount*(advpercentage/100);
|
|
if(isNaN(amount))
|
|
{
|
|
$('#AdvanceAmount').val('');
|
|
}
|
|
else
|
|
{
|
|
|
|
$('#AdvanceAmount').val((amount).toFixed(2));
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function validate()
|
|
{
|
|
if($("#AdvanceIn").val().length < 1)
|
|
{
|
|
alert('Please Enter PONO');
|
|
$("#AdvanceIn").focus();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>>
|