948 lines
33 KiB
PHP
948 lines
33 KiB
PHP
|
<?php
|
||
|
|
||
|
include('top.php');
|
||
|
$TABLENAME='production_schedule';
|
||
|
$TABLENAME1='purchase_schedule';
|
||
|
$this_script='add_warehouse.php';
|
||
|
$this_script1='internal_inspection.php';
|
||
|
$this_script1='external_inspection.php';
|
||
|
$acn=$_REQUEST['acn'];
|
||
|
?>
|
||
|
<link
|
||
|
href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
||
|
<script>
|
||
|
$(document).ready(function () {
|
||
|
var old_gatepass = document.getElementById('job_order_no').value;
|
||
|
// alert(old_gatepass);
|
||
|
if(old_gatepass==''){
|
||
|
out_gate_pass();
|
||
|
}
|
||
|
|
||
|
});
|
||
|
function out_gate_pass(){
|
||
|
var firm_id=document.getElementById('firm_id_new').value;
|
||
|
|
||
|
function stateChangedState()
|
||
|
{
|
||
|
|
||
|
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
|
||
|
{
|
||
|
|
||
|
|
||
|
document.getElementById('job_order_no').value=xmlHttp.responseText;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Params='request_type=out_gate_pass&firm_id='+firm_id;
|
||
|
SendAjaxRequest('ajax.php','POST',true,Params,stateChangedState);
|
||
|
|
||
|
}
|
||
|
</script>
|
||
|
<tr>
|
||
|
<td height="350" valign="top" style="padding: 10px;">
|
||
|
<table width="100%" border="0" cellspacing="0" cellpadding="0"
|
||
|
align="center">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<fieldset class="bdr1"><legend class="heading1">Warehouse Dispatch Details</legend>
|
||
|
<center><?php
|
||
|
if(isset($acn) && $acn=='delete')
|
||
|
{
|
||
|
if($_REQUEST['fid'])
|
||
|
{
|
||
|
mysqli_query($conn,"DELETE FROM final_warehouse WHERE fid='".$_REQUEST['fid']."'");
|
||
|
mysqli_query($conn,"DELETE FROM final_dispatch WHERE challon_no_new='".$_REQUEST['challon_no_new']."'");
|
||
|
}
|
||
|
}
|
||
|
if(isset($hid) && $hid=='1')
|
||
|
{
|
||
|
$hid='0';
|
||
|
|
||
|
$msg="Despatch Details Added Successfully";
|
||
|
$query_suffix="";
|
||
|
$query_additional="";
|
||
|
$query_prefix='Insert into ';
|
||
|
|
||
|
if(isset($frmacn) && $frmacn=='Update')
|
||
|
{
|
||
|
$query_prefix='update ';
|
||
|
$query_suffix=" where fid='".$fid."'";
|
||
|
$query_additional="";
|
||
|
$query_main=" SET installment_no='".$installment_no."',dispatch_id='".$uid."', purchase_order_no='".$po_no."',challon_no_new='".$challon_no_new."', production_file_no='".$pf_no."', item_id='".$item_id."', dispatch_qty='".$qty_offered."', date_marked_for_dispatch='".date_conversion($date_of_dispatch,"d-m-Y","Y-m-d")."', challan_date='".date_conversion($challan_date,"d-m-Y","Y-m-d")."', lot_end_date='". date_format(date_create($lot_end_date),'Y-m-d')."', item_desc='".$item_desc."',time_of_dispatch='".$time_of_dispatch."', mode_of_transfer='".$mode_of_transfer."', vehicle_no='".$vehicle_no."', isCompleted='".$isCompleted."', modified_by='".$_SESSION['user_id']."',dd_inspection='".$imp_instructions."',dd_packing='".$discount."',dd_delivery='".$for_terms."',dd_lr='".$delivery_period."',dd_vehicle='".$payment_terms."',dd_mode_transfer='".$po_frt."',dd_transporter='".$po_packing."',transporter_id='".$transporter_id."',dd_agent='".$po_insurance."',dd_sale_tax='".$po_sales."',dd_tol='".$po_tol."',dd_assur='".$po_assur."',dd_oth='".$oth_instructions."',challan_type='".$challan_type."',contact='".$contact."',loading_super='".$loading."' ";
|
||
|
$sql=$query_prefix.final_warehouse.$query_main.$query_additional.$query_suffix;
|
||
|
$res=@mysqli_query($conn,$sql);
|
||
|
}
|
||
|
|
||
|
$query_main=" SET installment_no='".$installment_no."',dispatch_id='".$uid."', purchase_order_no='".$po_no."',challon_no_new='".$challon_no_new."', production_file_no='".$pf_no."', item_id='".$item_id."', dispatch_qty='".$qty_offered."', date_marked_for_dispatch='".date_conversion($date_of_dispatch,"d-m-Y","Y-m-d")."', challan_date='".date_conversion($challan_date,"d-m-Y","Y-m-d")."', lot_end_date='". date_format(date_create($lot_end_date),'Y-m-d')."', item_desc='".$item_desc."',time_of_dispatch='".$time_of_dispatch."', mode_of_transfer='".$mode_of_transfer."', vehicle_no='".$vehicle_no."', isCompleted='".$isCompleted."', modified_by='".$_SESSION['user_id']."',dd_inspection='".$imp_instructions."',dd_packing='".$discount."',dd_delivery='".$for_terms."',dd_lr='".$delivery_period."',dd_vehicle='".$payment_terms."',dd_mode_transfer='".$po_frt."',dd_transporter='".$po_packing."',transporter_id='".$transporter_id."',dd_agent='".$po_insurance."',dd_sale_tax='".$po_sales."',dd_tol='".$po_tol."',dd_assur='".$po_assur."',dd_oth='".$oth_instructions."',challan_type='".$challan_type."',contact='".$contact."',loading_super='".$loading."' ";
|
||
|
$sql=$query_prefix.final_warehouse.$query_main.$query_additional.$query_suffix;
|
||
|
//echo "s==".$sql;
|
||
|
|
||
|
$res=@mysqli_query($conn,$sql);
|
||
|
|
||
|
if(isset($frmacn) && $frmacn=='Save')
|
||
|
{
|
||
|
$query_main2=" SET challon_no_new='".$challon_no_new."' ";
|
||
|
$sql2=$query_prefix.final_dispatch.$query_main2.$query_additional.$query_suffix;
|
||
|
}
|
||
|
$res2=@mysqli_query($conn,$sql2);
|
||
|
|
||
|
$sql_gatepass_test = "select * from outward_gatepass where gate_pass='".$gate_pass_no."'";
|
||
|
$res_gatepass_test = @mysqli_query($conn,$sql_gatepass_test);
|
||
|
$row_gatepass_test = @mysqli_fetch_array($res_gatepass_test);
|
||
|
|
||
|
if($frmacn!='Update' && $frmacn=='Save' && $row_gatepass_test <='0'){
|
||
|
$sql_gatePass = "insert into outward_gatepass set uniq_ref_no = '$challon_no_new', gate_pass = '".$gate_pass_no."', firm_id = '".$firm."', fid=(select max(fid) from final_warehouse)";
|
||
|
$res_gatePass = @mysqli_query($conn,$sql_gatePass);
|
||
|
}
|
||
|
if(!$res)
|
||
|
{
|
||
|
$msg="Error adding/updating Despatch Details.";
|
||
|
|
||
|
}
|
||
|
if($frmacn!='Update'){
|
||
|
echo "<script>location.replace('add_warehouse.php')</script>";
|
||
|
}else{
|
||
|
echo "<script>location.replace('flexi_warehouse.php?msg=$msg')</script>";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?> <?php if($acn=='add' || $acn=='update'|| $acn=='view') { ?> <?php
|
||
|
$sql="select id, po_no, pf_no, item_desc, item_id, drawing_id, alteration_no, qty_offered from order_item_marking where id='".$id."'";
|
||
|
$res=@mysqli_query($conn,$sql);
|
||
|
$row=@mysqli_fetch_array($res);
|
||
|
@extract($row);
|
||
|
if($acn=='add'){
|
||
|
$qty_produced = getProducedQty($id);
|
||
|
$qty_purchased = getPurchasedQty($id);
|
||
|
//echo "qty_produced:".$qty_produced.",qty_purchased:".$qty_purchased;
|
||
|
$qty_ready=$qty_produced+$qty_purchased;
|
||
|
|
||
|
$qty_pending_dispatch=getPendingReadyDispatchWarehousePerInstallment($id,$installment_no);
|
||
|
}else if($acn=='update'){
|
||
|
|
||
|
$sql2="select * from final_warehouse where fid='".$_REQUEST['fid']."'";
|
||
|
|
||
|
$res2=@mysqli_query($conn,$sql2);
|
||
|
$row2=@mysqli_fetch_array($res2);
|
||
|
@extract($row2);
|
||
|
$qty_pending_dispatch=$dispatch_qty;
|
||
|
$lot_end_date=date_conversion($lot_end_date,"Y-m-d","d-m-Y");
|
||
|
//echo $lot_end_date;
|
||
|
}
|
||
|
?>
|
||
|
<form name="form1" method="post" action="<?php echo $this_script?>"
|
||
|
onsubmit="return validateForm();">
|
||
|
|
||
|
<table width="100%" border="0" align="center">
|
||
|
<tr>
|
||
|
<td valign="top" style="padding: 10px;" align="left" width="60%">
|
||
|
<table border="0" cellspacing="0" cellpadding="0" align="left"
|
||
|
width="100%">
|
||
|
<tr align="left">
|
||
|
<td valign="top">
|
||
|
<fieldset class="bdr1"><legend class="headings">Order Details</legend>
|
||
|
<center>
|
||
|
<table width="100%" border="0" align="center">
|
||
|
<tr align="left">
|
||
|
<td class="VerdanaMediumBlack" bgcolor="#eeeeee">Purchase Order
|
||
|
No.</td>
|
||
|
<td class="bdr_td"> <?php echo $po_no?> <input type="hidden"
|
||
|
name="po_no" value="<?php echo $po_no?>" /><input type="hidden"
|
||
|
name="uid" value="<?php echo $id?>" /><input type="hidden" name="fid"
|
||
|
value="<?php echo $fid?>" /><input type="hidden" name="installment_no"
|
||
|
value="<?php echo $installment_no?>" /></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr align="left">
|
||
|
<input type="hidden" name="dispatch_id"
|
||
|
value="<?php echo $_REQUEST['id']?>" />
|
||
|
<td bgcolor="#eeeeee" class="VerdanaMediumBlack">Production
|
||
|
File No</td>
|
||
|
<td class="bdr_td"> <?php echo $pf_no?><input type="hidden"
|
||
|
name="pf_no" value="<?php echo $pf_no?>" /></td>
|
||
|
</tr>
|
||
|
<tr align="left">
|
||
|
<td class="VerdanaMediumBlack" bgcolor="#eeeeee">Drawing
|
||
|
Details</td>
|
||
|
<td class="bdr_td"><?php echo getDrawingDetail($drawing_id);?>,<?php echo $alteration_no?></td>
|
||
|
</tr>
|
||
|
<tr align="left">
|
||
|
|
||
|
<td class="VerdanaMediumBlack" bgcolor="#eeeeee">PL NO</td>
|
||
|
<td class="bdr_td"><?php echo getPO_Detail_value($po_no,$item_desc, 'pl_no')?></td>
|
||
|
</tr>
|
||
|
<tr align="left">
|
||
|
<td class="VerdanaMediumBlack" bgcolor="#eeeeee">Item
|
||
|
Description</td>
|
||
|
<td class="bdr_td"> <?php echo $item_desc?><input type="hidden"
|
||
|
name="item_id" value="<?php echo $item_id?>" /><input type="hidden"
|
||
|
name="item_desc" value="<?php echo $item_desc?>" /></td>
|
||
|
</tr>
|
||
|
<?php $unit_name= getUnitName(getUnitId($id));?>
|
||
|
<tr align="left">
|
||
|
<td class="VerdanaMediumBlack" bgcolor="#eeeeee">Order Qty</td>
|
||
|
<td class="bdr_td"><?php echo $qty1=getPO_Detail_value($po_no,$item_desc, 'qty').'-'.$unit_name?>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td bgcolor="#eeeeee" ><span class="VerdanaMediumBlack">Inspected Quantity</span></td>
|
||
|
<td class="bdr_td"><?php echo $qty1=getInspectedInternalByInstallment($inspection_uid,$installment_no).'-'.getUnitName(getUnitId($id)); ?></td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
|
||
|
<tr align="left">
|
||
|
<td class="VerdanaMediumBlack" bgcolor="#eeeeee">Total warehoused Qty </td>
|
||
|
<td class="bdr_td"><?php echo $SuppliedQty1=getDispatchedWarehouseQtyPerInstallment($id,$installment_no);?> </td>
|
||
|
</tr>
|
||
|
<tr align="left">
|
||
|
<td class="VerdanaMediumBlack" bgcolor="#eeeeee">Total Balanced Qty </td>
|
||
|
<td class="bdr_td"><?php echo $balance1=$qty1-$SuppliedQty1.'-'.$unit_name?> </td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</center>
|
||
|
</fieldset>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</td>
|
||
|
|
||
|
<?php $today=date("d-m-Y");
|
||
|
if($acn=='add')
|
||
|
{
|
||
|
$d=$today;
|
||
|
}
|
||
|
if($acn=='update') {
|
||
|
$d= date_conversion($date_marked_for_dispatch,"Y-m-d","d-m-Y");
|
||
|
}
|
||
|
|
||
|
|
||
|
?>
|
||
|
<?php
|
||
|
if($acn=='add'){
|
||
|
$month=date('n');
|
||
|
$year=date('Y');
|
||
|
if($month>3)
|
||
|
{
|
||
|
$year=$year;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$year=$year-1;
|
||
|
}
|
||
|
$firm=$pf_no;
|
||
|
$pos1=strpos($firm,"/");
|
||
|
$firm_code=substr($firm,0,$pos1);
|
||
|
//echo "a=".$firm_code;
|
||
|
|
||
|
$sql1="SELECT challon_no_new FROM final_dispatch where challon_no_new LIKE '"."DCH-".$firm_code."/"."%' AND challon_no_new LIKE '%".$year."' ";
|
||
|
// echo "b=".$sql1;
|
||
|
$res1 = @mysqli_query($conn,$sql1);
|
||
|
$i=0;
|
||
|
while($rows1 = @mysqli_fetch_array($res1))
|
||
|
{
|
||
|
$str=$rows1['challon_no_new'];
|
||
|
// echo "str=".$str;
|
||
|
$pos1=strpos($str,"/");
|
||
|
$pos2=strripos($str,"/");
|
||
|
$ref_no[$i] = substr($str,$pos1+1,$pos2-$pos1-1);
|
||
|
//echo "pos=".$ref_no[$i];
|
||
|
$i++;
|
||
|
|
||
|
}
|
||
|
if($ref_no){
|
||
|
$max = max ($ref_no)+1;
|
||
|
}
|
||
|
else {
|
||
|
$max=1;
|
||
|
}
|
||
|
$output="DCH-".$firm_code."/".$max."/".$year;
|
||
|
// echo $output;
|
||
|
$challon_no_new=$output;
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|
||
|
<td valign="top" rowspan="2" style="padding: 10px;">
|
||
|
<fieldset class="bdr1"><legend class="headings">Warehouse Dispatch Details</legend>
|
||
|
<center>
|
||
|
<table width="100%" border="0" align="center">
|
||
|
<tr align="left">
|
||
|
<td bgcolor="#eeeeee" class="VerdanaMediumBlack">Challan No</td>
|
||
|
<td align="left">
|
||
|
<?php
|
||
|
if($acn=='add') {
|
||
|
|
||
|
|
||
|
?>
|
||
|
<input type="text" id="challon_no_new1" class="textbox1" readonly="readonly" name="challon_no_new" value="<?php echo $challon_no_new?>" />
|
||
|
|
||
|
Use New<input type="radio" name="answer" value="yes"/>
|
||
|
Use Existing<input type="radio" id="ac" name="answer" value="no"/>
|
||
|
|
||
|
|
||
|
|
||
|
<script>
|
||
|
|
||
|
$("input[type='radio']").change(function(){
|
||
|
|
||
|
if($(this).val()=="no")
|
||
|
{
|
||
|
|
||
|
document.getElementById('dateimage').style.visibility="hidden";
|
||
|
|
||
|
|
||
|
document.getElementById("challon_no_new").disabled = false;
|
||
|
$("#challon_no_new").show();
|
||
|
$("#challon_no_new1").hide();
|
||
|
|
||
|
document.getElementById("challon_no_new1").disabled = true;
|
||
|
document.getElementById("challan_type_new").disabled = true;
|
||
|
document.getElementsByName('challan_type').value='';
|
||
|
|
||
|
document.getElementById("imp_instructions").disabled = true;
|
||
|
|
||
|
document.getElementById("for_terms").disabled = true;
|
||
|
document.getElementById("delivery_period").disabled = true;
|
||
|
document.getElementById("payment_terms").disabled = true;
|
||
|
document.getElementById("po_frt").disabled = true;
|
||
|
document.getElementById("po_packing").disabled = true;
|
||
|
document.getElementById("po_insurance").disabled = true;
|
||
|
document.getElementById("oth_instructions").disabled = true;
|
||
|
|
||
|
|
||
|
document.getElementById("contact").disabled = true;
|
||
|
document.getElementById("loading").disabled = true;
|
||
|
}
|
||
|
else if($(this).val()=="yes")
|
||
|
{
|
||
|
out_gate_pass();
|
||
|
document.getElementById("dateimage").style.visibility="visible";
|
||
|
|
||
|
document.getElementById("challan_type_new").disabled = false;
|
||
|
document.getElementById("imp_instructions").disabled = false;
|
||
|
|
||
|
document.getElementById("for_terms").disabled = false;
|
||
|
document.getElementById("delivery_period").disabled = false;
|
||
|
document.getElementById("payment_terms").disabled = false;
|
||
|
document.getElementById("po_frt").disabled = false;
|
||
|
document.getElementById("po_packing").disabled = false;
|
||
|
document.getElementById("po_insurance").disabled = false;
|
||
|
document.getElementById("oth_instructions").disabled = false;
|
||
|
|
||
|
document.getElementById("contact").disabled = false;
|
||
|
document.getElementById("loading").disabled = false;
|
||
|
|
||
|
|
||
|
document.getElementById("challon_no_new1").disabled = false;
|
||
|
$("#challon_no_new1").show();
|
||
|
$("#challon_no_new").hide();
|
||
|
$("#challon_no_new1").show();
|
||
|
document.getElementById("challon_no_new").disabled = true;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
</script>
|
||
|
|
||
|
|
||
|
<?php
|
||
|
$tk=date_conversion($today,"d-m-Y","Y-m-d");
|
||
|
|
||
|
$purchase=$po_no;
|
||
|
$pos1=strpos($purchase,"_RT");
|
||
|
if($pos1!="")
|
||
|
|
||
|
{
|
||
|
$purchase=substr($purchase,0,$pos1);
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
<select style="display:none;" class="selectbox" name="challon_no_new" id="challon_no_new" onchange="getDeliveryChallanDetails(this.value,'challan_type_existing','date_of_dispatch');" onblur="old_gatepass();" >
|
||
|
<option value="">--Select--</option>
|
||
|
<?php echo generateOptionForDispatchWare('final_warehouse','challon_no_new','fid','', $purchase,$tk);?>
|
||
|
</select>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<?php } ?> <!-- if of acn=add ended -->
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<?php if($acn=='update') { ?>
|
||
|
<input type="text" class="textbox1" readonly="readonly" name="challon_no_new" value="<?php echo $challon_no_new?>" />
|
||
|
<?php } ?> </td>
|
||
|
</tr>
|
||
|
<?php
|
||
|
if($acn=='add')
|
||
|
{
|
||
|
$d1=$today;
|
||
|
}
|
||
|
if($acn=='update') {
|
||
|
$d1= date_conversion($challan_date,"Y-m-d","d-m-Y");
|
||
|
}
|
||
|
|
||
|
|
||
|
?>
|
||
|
<tr align="left">
|
||
|
<td bgcolor="#eeeeee" class="VerdanaMediumBlack">Challan Date </td>
|
||
|
<td align="left"><input type="text" readonly="readonly" class="textbox1"
|
||
|
name="challan_date" id="challan_date"
|
||
|
value="<?php echo $d1?>" /> </td>
|
||
|
</tr>
|
||
|
<tr align="left">
|
||
|
<td> </td>
|
||
|
<td align="left"> </td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr align="left">
|
||
|
<td align="left"bgcolor="#eeeeee" class="VerdanaMediumBlack">Date of Dispatch</td>
|
||
|
<td align="left"><input type="text" class="textbox1" readonly="readonly"
|
||
|
name="date_of_dispatch" id="date_of_dispatch"
|
||
|
value="<?php echo $d?>" />
|
||
|
<a href="javascript:NewCal('date_of_dispatch','DDMMYYYY')">
|
||
|
<?php if($acn=='add') { ?>
|
||
|
<img id="dateimage"
|
||
|
src="images/cal.gif" width="16" height="16" border="0" style="display:inline"
|
||
|
alt="Pick a date" /></a> <?php } ?></td>
|
||
|
</tr>
|
||
|
<tr align="left">
|
||
|
<td bgcolor="#eeeeee" class="VerdanaMediumBlack">Quantity</td>
|
||
|
<td align="left"><input type="text" class="textbox1"
|
||
|
name="qty_offered" id="qty_offered" value="<?php echo $qty_pending_dispatch?>" onkeypress="return numbersonly(this,event, true);" /></td>
|
||
|
</tr>
|
||
|
<tr align="left">
|
||
|
<td bgcolor="#eeeeee" class="VerdanaMediumBlack">Dispatch Against DP Lot </td>
|
||
|
|
||
|
|
||
|
<?php
|
||
|
$sql_po_dp_count="";
|
||
|
if(has_amendments($po_no)){
|
||
|
$sql_po_dp_count=" select a.item_desc_new,a.purchase_order_no,item_desc_new,a.qty,delivery_date, Date_Format(delivery_start_date,'%e-%c-%Y') as delivery_start_date,a.delivery_destination,a.remarks from purchase_order_delivery_schedule_amendment a, order_item_marking b where a.purchase_order_no=b.po_no and a.item_desc_new=b.item_desc and b.id='".$id."' and a.amendment_no=(select max(amendment_no) from purchase_order_delivery_schedule_amendment where purchase_order_no='".$po_no."') order by cast(delivery_date as datetime) asc";
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}else{
|
||
|
$sql_po_dp_count ="select a.item_desc_new,a.purchase_order_no,a.qty, a.item_desc_new,delivery_date, Date_Format(delivery_start_date,'%e-%c-%Y') as delivery_start_date,a.delivery_destination,a.remarks from purchase_order_delivery_schedule a, order_item_marking b where a.purchase_order_no=b.po_no and a.item_desc_new=b.item_desc and b.id='".$id."' order by cast(delivery_date as datetime) asc";
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
// echo "0==".$sql_po_dp_count;
|
||
|
?>
|
||
|
<td align="left"><select class="selectbox1" id="lot_end_date" name="lot_end_date" onclick="return getPaymentTerm();"><option value=""></option>
|
||
|
<?php
|
||
|
|
||
|
$ressql_po_dp_count = mysqli_query($conn,$sql_po_dp_count);
|
||
|
while($rowssql_po_dp_count = mysqli_fetch_array($ressql_po_dp_count)){
|
||
|
@extract($rowssql_po_dp_count);
|
||
|
|
||
|
|
||
|
$delivery_date =date_conversion($rowssql_po_dp_count['delivery_date'],"Y-m-d","d-m-Y");
|
||
|
//echo "a===".$delivery_date;
|
||
|
|
||
|
$item_desc_new=$rowssql_po_dp_count['item_desc_new'];
|
||
|
//echo "b====".$item_desc_new;
|
||
|
$purchase_order_no=$po_no;
|
||
|
//echo "d===".$purchase_order_no;
|
||
|
|
||
|
$SuppliedQty=getDPPeriodSuppliedQty1($purchase_order_no,$item_desc_new,$delivery_date);
|
||
|
//echo "c===".$qty;
|
||
|
//echo "c===".$SuppliedQty;
|
||
|
|
||
|
|
||
|
if($delivery_date==$lot_end_date)
|
||
|
{
|
||
|
if($qty<=$SuppliedQty)
|
||
|
{
|
||
|
echo " ";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
|
||
|
|
||
|
echo "<option value='".date_format(date_create($delivery_date),'j-M-y')."' selected>".date_format(date_create($delivery_date),'j-M-y')."</option>" ;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if($qty<=$SuppliedQty)
|
||
|
{
|
||
|
echo " ";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
echo "<option value='".date_format(date_create($delivery_date),'j-M-y')."'>".date_format(date_create($delivery_date),'j-M-y')."</option>";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
|
||
|
</select></td>
|
||
|
</tr>
|
||
|
<tr align="left">
|
||
|
<td> </td>
|
||
|
<td align="left"> </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" class="VerdanaMediumBlack">Challan Type </td>
|
||
|
<td ><input name="challan_type_old" type="radio" value="Excise" onclick="start(this.value);" checked /> Excise
|
||
|
<input type="radio" name="challan_type_old" id="challan_type_new" onclick="start(this.value);" <?php if($challan_type=='NON excise'){?> checked="checked"<?php }?> value="NON excise" />Non Excise <textarea id="challan_type_existing" readonly="readonly" name="challan_type" style="display:none; width:5px; height:5px;" ></textarea> </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" class="VerdanaMediumBlack"><span class="style34">Inspection :</span></td>
|
||
|
<td ><input type="text" class="textbox2" name="imp_instructions" id="imp_instructions" value="<?php echo $dd_inspection?>" /> </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" align="left" class="VerdanaMediumBlack">Packing Details : </strong></td>
|
||
|
<td><input type="text" class="textbox2" name="discount" id="discount" value="<?php echo $dd_packing?>" /></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" class="VerdanaMediumBlack"><span class="style34">Delivery Instruction :</span></td>
|
||
|
<td ><input type="text" class="textbox2" name="for_terms" id="for_terms" value="<?php echo $dd_delivery?>" /></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" align="left" class="VerdanaMediumBlack">LR No :</strong></td>
|
||
|
<td ><input type="text" class="textbox2" name="delivery_period" id="delivery_period" value="<?php echo $dd_lr?>" ></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" class="VerdanaMediumBlack">Vehicle No :</td>
|
||
|
<td ><input type="text" class="textbox2" name="payment_terms" id="payment_terms" value="<?php echo $dd_vehicle?>" ></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" align="left" class="VerdanaMediumBlack" >Mode of Transport : </strong></td>
|
||
|
<td><input type="text" class="textbox2" name="po_frt" id="po_frt" value="<?php echo $dd_mode_transfer?>" /></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" align="left" class="VerdanaMediumBlack">Transporter : </strong></td>
|
||
|
<td><span class="bdr_td">
|
||
|
<?php $sql2="select * from final_warehouse where fid='".$_REQUEST['fid']."'";
|
||
|
|
||
|
$res2=@mysqli_query($conn,$sql2);
|
||
|
$row2=@mysqli_fetch_array($res2);
|
||
|
@extract($row2);
|
||
|
$transporter_id=$row2['transporter_id'];
|
||
|
$row2['transporter_id'];
|
||
|
?>
|
||
|
<select class="selectbox" name="transporter_id" id="transporter_id">
|
||
|
<option value="">--Select--</option>
|
||
|
<?php
|
||
|
$sql_firm ="select a.transporter_id,a.transporter_name from transporter_master a where a.active='Y' ";
|
||
|
//echo $sql_firm;
|
||
|
|
||
|
generate_options($sql_firm,$transporter_id,'transporter_id','transporter_name','');
|
||
|
?>
|
||
|
</select></span></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" align="left" class="VerdanaMediumBlack">Agent : </strong></td>
|
||
|
<td><input type="text" class="textbox2" name="po_insurance" id="po_insurance" value="<?php echo $dd_agent?>" /></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" align="left" class="VerdanaMediumBlack">Loading Supervisor : </strong></td>
|
||
|
<td><input type="text" class="textbox2" name="loading" id="loading" value="<?php echo $loading_super?>" /></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" align="left" class="VerdanaMediumBlack">Contact : </strong></td>
|
||
|
<td><input type="text" class="textbox2" name="contact" id="contact" value="<?php echo $contact?>" /></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee"class="VerdanaMediumBlack"><span class="style34">Remarks</span></td>
|
||
|
<td ><span class="style35">
|
||
|
<label>
|
||
|
<textarea name="oth_instructions" id="oth_instructions" cols="30" rows="10"><?php echo $dd_oth?></textarea>
|
||
|
</label>
|
||
|
</span></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td bgcolor="eeeeee" align="left" class="VerdanaMediumBlack">Outward Gate Pass</strong></td>
|
||
|
<td><input type="text" name="gate_pass_no" id="job_order_no" value="" class="textbox2"></td>
|
||
|
</tr>
|
||
|
<!--<tr>
|
||
|
<td bgcolor="eeeeee"class="VerdanaMediumBlack"><span class="style34">Outward Gate Pass</span></td>
|
||
|
<td ><span class="style35">
|
||
|
<label>
|
||
|
<input type="text" name="gate_pass_no" id="job_order_no" value="" readonly class="textbox1" style="width:100%;">
|
||
|
</label>
|
||
|
</span></td>
|
||
|
</tr>-->
|
||
|
<?php
|
||
|
$sqlFirm = "select firm_id from purchase_order_master where purchase_order_no = '$po_no'";
|
||
|
$resFirm = @mysqli_query($conn,$sqlFirm);
|
||
|
$rowFirm = @mysqli_fetch_array($resFirm);
|
||
|
?>
|
||
|
<input type="hidden" name="firm" id="firm_id_new" value="<?php echo $rowFirm['firm_id']?>">
|
||
|
|
||
|
</table>
|
||
|
<table id="tbl_payment"></table>
|
||
|
</center>
|
||
|
</fieldset>
|
||
|
<table width="100%">
|
||
|
<tr >
|
||
|
<td align="center" colspan="2"><input type="hidden" name="hid"
|
||
|
value="1"> <?php if($acn=='update') { ?> <input type="submit"
|
||
|
name="frmacn" value="Update" class="submitbutton" /> <?php }else{ ?>
|
||
|
<input type="submit" name="frmacn" value="Save" onclick="return checkPaymentTerm();"
|
||
|
class="submitbutton" /> <?php } ?> <input type="button" name="back"
|
||
|
class="submitbutton" value="Back" onclick="history.back();" /></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td style="padding: 10px;">
|
||
|
|
||
|
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||
|
<tr align="left">
|
||
|
<td width="100%" valign="top">
|
||
|
<fieldset class="bdr1">
|
||
|
<legend class="headings">Order Delivery
|
||
|
Schedule </legend>
|
||
|
<center>
|
||
|
|
||
|
<div id="Layer0" style="position:relative;height:80px; overflow:auto">
|
||
|
<table width="100%" border="0" align="center" style="height:80x;overflow:scroll;">
|
||
|
<tr align="center" bgcolor="#eeeeee">
|
||
|
|
||
|
<td width="8%" class="VerdanaMediumBlack"><strong> Lot.NO. </strong></td>
|
||
|
|
||
|
<td width="19%" class="VerdanaMediumBlack"><strong> Delivery Start Date </strong></td>
|
||
|
<td width="19%" class="VerdanaMediumBlack"><strong> Delivery End Date </strong></td>
|
||
|
<!-- <td class="VerdanaMediumBlack"><strong>Delivery Destination </strong></td>-->
|
||
|
<!-- <td class="VerdanaMediumBlack"><strong>Remarks</strong></td> -->
|
||
|
<td width="18%" class="VerdanaMediumBlack"><strong>Qty </strong></td>
|
||
|
<td width="18%" class="VerdanaMediumBlack"><strong>Quantity dispatched</strong></td>
|
||
|
|
||
|
</tr>
|
||
|
|
||
|
<?php
|
||
|
if(has_amendments($po_no)){
|
||
|
$sql_item="select a.item_desc_new,a.purchase_order_no,a.qty,delivery_date, Date_Format(delivery_start_date,'%e-%c-%Y') as delivery_start_date,a.delivery_destination,a.remarks from purchase_order_delivery_schedule_amendment a, order_item_marking b where a.purchase_order_no=b.po_no and a.item_desc_new=b.item_desc and b.id='".$id."' and a.amendment_no=(select max(amendment_no) from purchase_order_delivery_schedule_amendment where purchase_order_no='".$po_no."') order by cast(delivery_date as datetime) asc";
|
||
|
}
|
||
|
else{
|
||
|
$sql_item="select a.item_desc_new,a.purchase_order_no,a.qty, delivery_date, Date_Format(delivery_start_date,'%e-%c-%Y') as delivery_start_date,a.delivery_destination,a.remarks from purchase_order_delivery_schedule a, order_item_marking b where a.purchase_order_no=b.po_no and a.item_desc_new=b.item_desc and b.id='".$id."' order by cast(delivery_date as datetime) asc";
|
||
|
}
|
||
|
//echo "above==".$sql_item;
|
||
|
$res=@mysqli_query($conn,$sql_item);
|
||
|
$count=1;
|
||
|
while($row=@mysqli_fetch_array($res)) {
|
||
|
@extract($row);
|
||
|
|
||
|
|
||
|
$item_desc_new=$row['item_desc_new'];
|
||
|
//echo "b====".$item_desc_new;
|
||
|
$purchase_order_no=$po_no;
|
||
|
//echo "d===".$purchase_order_no;
|
||
|
|
||
|
$delivery_date =date_conversion($row['delivery_date'],"Y-m-d","d-m-Y");
|
||
|
//echo "date1==". $delivery_date;
|
||
|
$SuppliedQty=getDPPeriodSuppliedQty1($purchase_order_no,$item_desc_new,$delivery_date);
|
||
|
|
||
|
|
||
|
//echo "date==".$d_date;
|
||
|
$start_date=$row['delivery_start_date'];
|
||
|
|
||
|
if(isSet($delivery_date) && $delivery_date!=null && $delivery_date!='null'&& $delivery_date!=''&& $delivery_date!="0-0-0000"&&$delivery_date!="0000-00-00")
|
||
|
{
|
||
|
$delivery_date=$delivery_date ;
|
||
|
$delivery_date=date_format(date_create($delivery_date),'j-M-y');
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$delivery_date=" ";
|
||
|
}
|
||
|
// echo "start==".$start_date;
|
||
|
|
||
|
if(isSet($start_date) && $start_date!=null && $start_date!='null'&& $start_date!=''&& $start_date!="0-0-0000")
|
||
|
{
|
||
|
$delivery_start_date=$start_date;
|
||
|
$delivery_start_date=date_format(date_create($delivery_start_date),'j-M-y');
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$delivery_start_date=" ";
|
||
|
}
|
||
|
//echo "a===".$delivery_date;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
// echo "supply==".$SuppliedQty;
|
||
|
?>
|
||
|
<tr align="center">
|
||
|
<td align="Center" class="bdr_td"><?php echo $count ?></td>
|
||
|
<td align="Center" class="bdr_td"><?php echo $delivery_start_date?></td>
|
||
|
<td align="Center" class="bdr_td"><?php echo $delivery_date ?></td>
|
||
|
<!-- <td align="Center" class="bdr_td"> <?php echo $delivery_destination?></td>-->
|
||
|
<!-- <td align="Center" class="bdr_td"> <?php echo $remarks?></td>-->
|
||
|
|
||
|
|
||
|
<td align="Center" class="bdr_td"><?php echo $qty?></td>
|
||
|
|
||
|
<?php // echo "carry==".$carry." ";
|
||
|
// echo "qty==".$qty." ";
|
||
|
//echo "SuppliedQty==".$SuppliedQty." ";
|
||
|
// echo "t==".$t." ";
|
||
|
|
||
|
|
||
|
|
||
|
$carry= $qty-($SuppliedQty-$t);
|
||
|
|
||
|
|
||
|
|
||
|
//echo "qty==".$qty." ";
|
||
|
/// echo "SuppliedQty==".$SuppliedQty." ";
|
||
|
//echo "t==".$t." ";
|
||
|
// echo "carryafter==".$carry." ";
|
||
|
?>
|
||
|
<?php
|
||
|
|
||
|
if( $carry<0)
|
||
|
{
|
||
|
|
||
|
$SuppliedQty=$SuppliedQty+($carry-$t) ;
|
||
|
$carry=$carry;
|
||
|
|
||
|
$t=$carry;
|
||
|
}
|
||
|
if( $carry>0)
|
||
|
{
|
||
|
$SuppliedQty=$SuppliedQty-$t ;
|
||
|
$carry=0;
|
||
|
$t=0;
|
||
|
}
|
||
|
if($carry==0)
|
||
|
{
|
||
|
$SuppliedQty=$SuppliedQty-$t ;
|
||
|
$carry=0;
|
||
|
$t=0;
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
<td class="bdr_td"> <?php echo $SuppliedQty?></td>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</tr>
|
||
|
<?php
|
||
|
$count++;
|
||
|
}//end of while
|
||
|
?>
|
||
|
</table>
|
||
|
|
||
|
</fieldset>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td style="padding: 10px;"> </td>
|
||
|
</tr>
|
||
|
|
||
|
</table>
|
||
|
</form>
|
||
|
<?php } else { echo "<script>location.href ='flexi_warehouse.php';</script>";?>
|
||
|
<?php } ?>
|
||
|
</center>
|
||
|
</fieldset>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<?php include('footer.php'); ?>
|
||
|
<script>
|
||
|
var fieldArray = new Array(new Array('date_of_dispatch','qty_offered','lot_end_date','transporter_id'),
|
||
|
new Array('Please provide dispatch date.',' Please provide a value for Dispatch Qty.','Please provide a value for Dispatch against Dp lot .','Plese select Transporter.'));
|
||
|
|
||
|
function validateForm()
|
||
|
{
|
||
|
var elementId = document.getElementById('ac');
|
||
|
if (elementId.checked==false)
|
||
|
{
|
||
|
document.getElementById("challon_no_new").disabled = true;
|
||
|
|
||
|
}
|
||
|
return checkform('form1',fieldArray)
|
||
|
}
|
||
|
function outward_gatepass(){
|
||
|
var gate_pass = document.getElementById('job_order_no').value;
|
||
|
if(gate_pass == ''){
|
||
|
alert("Gate Pass required");
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
<script>
|
||
|
function getDeliveryChallanDetails(Id,divid_resp,divid_resp1)
|
||
|
{
|
||
|
//alert(Id);
|
||
|
//alert(divid_resp);
|
||
|
function stateChangedState()
|
||
|
{
|
||
|
if(xmlHttp.readyState!=4)
|
||
|
{
|
||
|
document.getElementById(divid_resp).value= 'Loading....';
|
||
|
}
|
||
|
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
|
||
|
{
|
||
|
try{
|
||
|
var srts=xmlHttp.responseText;
|
||
|
var first =srts.split("**");
|
||
|
//alert(srts);
|
||
|
//alert(first[0]);
|
||
|
//alert(first[1]);
|
||
|
|
||
|
var r = first[1].match(/^\s*([0-9]+)\s*-\s*([0-9]+)\s*-\s*([0-9]+)(.*)$/);
|
||
|
var s= r[3]+"-"+r[2]+"-"+r[1]+r[4];
|
||
|
//alert(s);
|
||
|
|
||
|
|
||
|
document.getElementById(divid_resp).value=first[0];
|
||
|
|
||
|
document.getElementById(divid_resp1).value=s;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}catch(exception){
|
||
|
|
||
|
//
|
||
|
// var second=
|
||
|
|
||
|
divid_resp.innerHTML=xmlHttp.responseText;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
Params='request_type=getDeliveryChallanDetails&Id='+Id;
|
||
|
SendAjaxRequest('ajax.php','POST',true,Params,stateChangedState);
|
||
|
|
||
|
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<script>
|
||
|
var radios = document.getElementsByName('challan_type_old');
|
||
|
|
||
|
for (var i = 0, length = radios.length; i < length; i++) {
|
||
|
if (radios[0].checked) {
|
||
|
//alert(radios[0].value);
|
||
|
var a="Excise";
|
||
|
document.getElementById("challan_type_existing").value =a;
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
function start(st)
|
||
|
{
|
||
|
if(st=="NON excise")
|
||
|
{
|
||
|
document.getElementById("challan_type_existing").value="NON excise";
|
||
|
}
|
||
|
else if(st=="Excise")
|
||
|
{
|
||
|
document.getElementById("challan_type_existing").value="Excise";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function getPaymentTerm(){
|
||
|
var Id = document.getElementById('firm_id_new').value;
|
||
|
//alert(Id);
|
||
|
function stateChangedState()
|
||
|
{
|
||
|
|
||
|
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
|
||
|
{
|
||
|
|
||
|
|
||
|
document.getElementById('tbl_payment').innerHTML=xmlHttp.responseText;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Params='request_type=getPaymentTerm&Id='+Id;
|
||
|
SendAjaxRequest('ajax.php','POST',true,Params,stateChangedState);
|
||
|
|
||
|
}
|
||
|
function getPaymentTerm1(){
|
||
|
|
||
|
var payment_term = document.getElementById('payment_term_name').value;
|
||
|
if(payment_term=='NULL'){
|
||
|
alert('Payment Term is not updated for this Client');
|
||
|
}
|
||
|
}
|
||
|
function checkPaymentTerm(){
|
||
|
var payment_term = document.getElementById('payment_term_name').value;
|
||
|
if(payment_term=='NULL'){
|
||
|
alert('Payment Term is not updated for this Client');
|
||
|
}
|
||
|
var count = document.getElementById('count_payment').value;
|
||
|
//alert(count);
|
||
|
for(var i=0;i<count;i++){
|
||
|
var due_val = document.getElementById('msg_payment'+i).value;
|
||
|
if(due_val == 'Payment Due for this Client'){
|
||
|
alert(due_val);
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
function old_gatepass(){
|
||
|
var val = document.getElementById('challon_no_new').value;
|
||
|
function stateChangedState()
|
||
|
{
|
||
|
|
||
|
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
|
||
|
{
|
||
|
|
||
|
|
||
|
document.getElementById('job_order_no').value=xmlHttp.responseText;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Params='request_type=old_gatepass&val='+val;
|
||
|
SendAjaxRequest('ajax.php','POST',true,Params,stateChangedState);
|
||
|
|
||
|
}
|
||
|
</script>
|