118 lines
4.9 KiB
PHP
118 lines
4.9 KiB
PHP
<?php
|
|
header("Content-type:application/octet-stream");
|
|
|
|
header("Content-type: application/x-msdownload");
|
|
header("Content-Disposition: attachment; filename=excel_procurement.xls");
|
|
header("Pragma: no-cache");
|
|
header("Expires: 0");
|
|
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
|
|
?>
|
|
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php')
|
|
//include('pop_up_top.php');
|
|
?>
|
|
|
|
<body>
|
|
<table width="100%">
|
|
<tr>
|
|
<div style="font-size:12px">
|
|
<td width="25%" align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
|
|
<td width="50%" align="center" style="font-size:20px"><strong>Procurement List</strong></td>
|
|
<td width="25%" align="left"> User : <?php echo $username ?></td>
|
|
</tr>
|
|
</table>
|
|
<table border="1" width="100%">
|
|
<?php
|
|
// $sql = "select procurement.procurement_id, procurement.procurement_refno,procurement.procurement_date from procurement order by procurement.procurement_id";
|
|
//echo
|
|
$sql = base64_decode($filterkey);
|
|
$result = mysqli_query($conn, $sql);
|
|
error_log("filter:" . $filterkey);
|
|
?><strong>
|
|
<tr bgcolor="#eeeeee">
|
|
<td valign="top" align="left" width="2%" style="font-size:4px">Sr No</td>
|
|
<!-- <td align="left" width="15%">Procurement Reference No.</td> -->
|
|
<td align="left" width="15%">Invoice no</td>
|
|
<td align="left" width="10%">Invoice Date</td>
|
|
<td valign="top" align="left" width="30%">Item name</td>
|
|
<td valign="top" width="5%" align="left">Quantity</td>
|
|
<td width="5%" valign="top" align="left">Batch</td>
|
|
<td width="5%" valign="top" align="left">Per Unit Price</td>
|
|
<td width="5%" valign="top" align="left">GST(%)</td>
|
|
<td valign="top" width="10%" align="left">Expiry</td>
|
|
<td valign="top" align="left" width="10%">New Value</td>
|
|
<td valign="top" align="left" width="15%">Item Remarks</td>
|
|
</strong></tr>
|
|
|
|
<?php
|
|
while ($row1 = mysqli_fetch_array($result)) {
|
|
$sql_procure_items = "select * from procurement_items where procurement_id='" . $row1['procurement_id'] . "'";
|
|
$results_procure_items = mysqli_query($conn, $sql_procure_items);
|
|
$item_desc = "";
|
|
$item_qty = "";
|
|
$item_batch = "";
|
|
$item_expiry_date = "";
|
|
$item_rate = "";
|
|
$tax = "";
|
|
$per_unit = "";
|
|
$rows_count = mysqli_num_rows($results_procure_items);
|
|
|
|
?><tr>
|
|
<td rowspan="<?php echo $rows_count ?>"><?php echo ++$s_count;
|
|
?></td>
|
|
<td rowspan="<?php echo $rows_count ?>"><?php echo $row1['invoice_no'] ?>
|
|
</td>
|
|
<td rowspan="<?php echo $rows_count ?>"><?php echo $row1['procurement_date'] ?>
|
|
</td><?php
|
|
$count = 0;
|
|
while ($row_procure_items = mysqli_fetch_assoc($results_procure_items)) {
|
|
++$count;
|
|
if ($count == 1) {
|
|
|
|
$item_desc = getTableFieldValue('tbl_items', 'item_name', 'item_id', $row_procure_items['item_id']);
|
|
$item_qty = $row_procure_items['qty'];
|
|
$item_batch = $row_procure_items['batch'];
|
|
$item_expiry_date = date_format(date_create($row_procure_items['expiry']), "d-M-Y ");
|
|
$item_rate = $row_procure_items['net_value'];
|
|
$item_remarks = $row_procure_items['remarks'];
|
|
$tax = $row_procure_items['tax'];
|
|
$per_unit = $row_procure_items['per_unit_rate'];
|
|
?><td><?php echo $item_desc ?></td>
|
|
<td><?php echo $item_qty ?></td>
|
|
<td><?php echo $item_batch ?></td>
|
|
<td><?php echo $per_unit ?></td>
|
|
<td><?php echo $tax ?></td>
|
|
<td><?php echo $item_expiry_date ?></td>
|
|
<td><?php echo $item_rate ?></td>
|
|
<td><?php echo $item_remarks ?></td>
|
|
<?php } else {
|
|
$item_desc = getTableFieldValue('tbl_items', 'item_name', 'item_id', $row_procure_items['item_id']);
|
|
$item_qty = $row_procure_items['qty'];
|
|
$item_batch = $row_procure_items['batch'];
|
|
$item_expiry_date = date_format(date_create($row_procure_items['expiry']), "d-M-Y ");
|
|
$item_rate = $row_procure_items['net_value'];
|
|
$item_remarks = $row_procure_items['remarks'];
|
|
$tax = $row_procure_items['tax'];
|
|
$per_unit = $row_procure_items['per_unit_rate'];
|
|
|
|
?>
|
|
</tr>
|
|
<tr>
|
|
<td><?php echo $item_desc ?></td>
|
|
<td><?php echo $item_qty ?></td>
|
|
<td><?php echo $item_batch ?></td>
|
|
<td><?php echo $per_unit ?></td>
|
|
<td><?php echo $tax ?></td>
|
|
<td><?php echo $item_expiry_date ?></td>
|
|
<td><?php echo $item_rate ?></td>
|
|
<td><?php echo $item_remarks ?></td>
|
|
</tr>
|
|
<?php }
|
|
}
|
|
if ($rows_count == 1) {
|
|
?></tr><?php
|
|
}
|
|
}
|
|
?>
|
|
</table>
|