ESH/excel_sample_list.php
2024-10-23 18:28:06 +05:30

161 lines
6.2 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/auth/auth.php');
include_once("includes/functions.php");
$TABLENAME='tbl_firms';
$this_script='manage_firms.php';
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=Pilot_sample.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<html>
<style type="text/css">
<!--
.style1 {font-size: small}
-->
</style>
<body>
<table width="100%" border="1" cellspacing="1" cellpadding="1" style="font:Arial, Helvetica, sans-serif; font-size:10px;">
<tr><td colspan="3" align="left">RUNDATE: <?php echo date("d-m-Y")?></td> <td align="right" colspan="14"><?php echo $username ?> </td> </tr>
<tr>
<td height="45" colspan="17" align="center" ><strong><font size="+3" color="#FF6600">PILOT SAMPLE STATUS</font></strong></td>
</tr>
<tr>
<?php
$sql=base64_decode($filterkey);
// echo $sql;
$paramdetails=base64_decode($paramlist); ?>
<td colspan="17" align="center"><strong><?php echo $paramdetails; ?></strong> </td>
</tr>
<tr class="bg2">
<th width="3%" align="center"><strong>Sr. <br>
No</strong></th>
<th width="10%" align="center"><strong>Client</strong></th>
<th width="11%" align="center"><strong>Date <br>
Purchase order </strong></th>
<th width="9%" align="center"><strong>Production<br>
File No</strong></th>
<th width="8%" align="center"><strong>Purchase<br>
Order No</strong></th>
<th width="4%" align="center"><strong>Item</strong></th>
<th width="5%" align="center"><strong>PL No</strong></th>
<th width="14%" align="center"><strong>Item Description</strong></th>
<th width="7%" align="center"><strong>Drawing</strong></th>
<th width="5%" align="center"><strong>Order<br>
Qty</strong></th>
<th width="3%" align="center">Lot<br>
No</th>
<th width="4%" align="center">DP <br>
Start</th>
<th width="4%" align="center">DP<br>
End</th>
<th width="9%" align="center">Scheduled<br>
Qty</th>
<th width="4%" align="center">ID</th>
<th width="4%" align="center">Status</th>
<th width="4%" align="center">Memo No</th>
</tr>
<?php
$count=1;
$result = mysqli_query($conn,base64_decode($filterkey));
while($row=@mysqli_fetch_array($result))
{
extract($row);
if(!isset($dates)){
$dates=explode(",","01/01/2006,01/01/2022");
}
$id=$row['id'];
//$installment_no=$row['call_installment_no'];
$status=$row['internal_result'];
$memo=$row['memo'];
$po_no=$row['po_no'];
$item_desc=$row['item_desc'];
$item_enc = base64_encode($item_desc);
$pf_no=$row['pf_no'];
//$client_id = getFieldFromTable(client_id,purchase_order_master,production_file_no,$pf_no);
$pl_no = getPO_Detail_value($po_no,$item_desc,pl_no);
$client = getClientInfo($row['client_id'],$row['client_location_id']);
$lot_no ="";
$delivery_start_date="";
$delivery_date="";
$dp_qty="";
$lot_dispatch_qty="";
$bal_qty1="";
if(has_amendments($row['purchase_order_no'])){
$sql_dp="select qty as dp_qty,Date_Format(delivery_date,'%e-%c-%Y') as delivery_date, Date_Format(delivery_start_date,'%e-%c-%Y') as delivery_start_date, getDPLotNo(purchase_order_no, item_desc_new,delivery_date) as lot_no from purchase_order_delivery_schedule_amendment where purchase_order_no='".$po_no."' and item_desc_new='".$item_desc."' and amendment_no = (select max(amendment_no) from purchase_order_delivery_schedule_amendment where purchase_order_no='".$po_no."') ORDER BY str_to_date(delivery_date,'%Y-%m-%d') ASC ";
}else{
$sql_dp="select qty as dp_qty,Date_Format(delivery_date,'%e-%c-%Y') as delivery_date, Date_Format(delivery_start_date,'%e-%c-%Y') as delivery_start_date, getDPLotNo(purchase_order_no, item_desc_new,delivery_date) as lot_no from purchase_order_delivery_schedule where purchase_order_no='".$po_no."' and item_desc_new='".$item_desc."' ORDER BY str_to_date(delivery_date,'%Y-%m-%d') ASC ";
}
//echo $sql;
$res_dp=@mysqli_query($conn,$sql_dp);
while($row_dp=@mysqli_fetch_array($res_dp)) {
//$dl_dt.= "<p>".date_conversion($row_d['delivery_date'],"Y-m-d","j-M-y").'-('.$row_d['dp_qty'].")</p>";
$lot_no = $lot_no.' <p> '.$row_dp['lot_no'].'</p>';
$delivery_start_date = $delivery_start_date.' <p> '.$row_dp['delivery_start_date'].'</p>';
$delivery_date=$delivery_date.' <p> '.$row_dp['delivery_date'].'</p>';
$dp_qty= $dp_qty.' <p> '.$row_dp['dp_qty'].'</p>';
$lot_dispatch_qty= $lot_dispatch_qty.' <p> '.getDPPeriodSuppliedQty($purchase_order_no,$item_desc_new,$row_dp['delivery_date']).'</p>';
$bal_qty1=$bal_qty1.' <p> '.($row_dp['dp_qty']-getDPPeriodSuppliedQty($purchase_order_no,$item_desc_new,$row_dp['delivery_date'])).'</p>';
}
$drawing= getDrawingDetail($row['drawing_id']).','.$row['alteration_no'];
$return_qty=getReturnQty($po_no, $item_desc);
$order_qty= $row['orderQty'];
$marked_qty=$row['qty_offered'];
$dispatched_qty=getSuppliedQty($po_no, $item_desc);
$balance_qty=$row['balQty'];//$order_qty+$return_qty-$dispatched_qty;
//$purchase_order_Date=date_conversion($row['purchase_order_Date'],"Y-m-d","j-M-y");
$id1=$id;
$unit_details='-'.getUnitName(getUnitId($id));
$dd=date_conversion($row['purchase_order_Date'],"Y-m-d","j-M-y")
?>
<tr>
<td valign="top"><?php echo $count++?></td><td valign="top"><?php echo $client?></td><td valign="top"><?php echo $dd?></td><td valign="top"><?php echo $row['pf_no']?></td><td valign="top"><?php echo $row['po_no']?></td><td valign="top"><?php echo getItemName(getPO_Detail_value($po_no,$item_desc,item_id))?></td><td valign="top"><?php echo $pl_no?></td><td valign="top"><?php echo $item_desc?></td><td valign="top"><?php echo $drawing?></td><td valign="top"><?php echo $order_qty.$unit_details?></td>
<td valign="top"><?php echo $lot_no?></td><td valign="top"><?php echo $delivery_start_date?></td><td valign="top"><?php echo $delivery_date?></td><td valign="top"><?php echo $row['scheduledQty'].$unit_details?></td><td valign="top"><?php echo $id1?></td><td valign="top"><?php echo $status?></td><td valign="top"><?php echo $memo?></td>
</tr>
<?php
}
?>
</table>
</body>
</html>