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

183 lines
5.6 KiB
PHP

<?php //include('pdf_header_reverse.php');
include('includes/config/config.php');
include('includes/functions.php');
//include('pop_up_top.php');
$start = $_POST['adii_date1'];
$end = $_POST['adii_date2'];
$location = $_POST['location'];
if(!empty($_POST['ambulance_number'])){
$amb_no_box_code = $_POST['ambulance_number'];
$title_name = getTableFieldValue('ambulance_details_new', 'ambulance_number', 'id', $_POST['ambulance_number']);
}
if(!empty($_POST['box_number'])){
$amb_no_box_code = $_POST['box_number'];
$title_name = getTableFieldValue('first_aid_box', "CONCAT(box_code,'-',box_name)", 'box_id', $_POST['box_number']);
}
if(!empty($_POST['p_id'])){
$amb_no_box_code = $_POST['p_id'];
$title_name = getTableFieldValue('patient_master', 'patient_name', 'id', $_POST['p_id']);
}
$ohc_loc = getTableFieldValue('ohc_type', 'ohc_type_name', 'ohc_type_id', $_POST['location']);
// $month_name = "$start - $end";
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<style>
@page {
margin: 15px;
}
.btn {
background-color: #4CAF50;
border-radius: 5%;
/* Green */
border: none;
color: white;
padding: 5px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
margin: 4px 2px;
cursor: pointer;
}
@media print {
#printPageButton {
display: none;
}
}
</style>
<body>
<?php include('pdf_ohc_header.php'); ?>
<table width="100%">
<tr>
<td style="font-size: 15px;"><strong style="margin-left: 600px">Add Direct Item Issue Report</strong></td>
<br>
</tr>
</table>
<br>
<table width="100%">
<tr>
<td style="font-size: 12px;"><strong style="margin-left: 600px"><?php echo $ohc_loc." (".$title_name.")" ?></strong></td>
<br>
</tr>
</table>
<table width="100%">
<tr>
<td align="left" style="font-size: 12px"><strong>For Duration: <?php echo $start; ?> -
<?php echo $end; ?></strong></td>
<td align="right" style="font-size: 15px"><button align="center" id="printPageButton" class="btn btn-success" onClick="window.print();">Print</button></td>
</tr>
</table>
<br>
<table border="1" width="100%" cellspacing="0">
<?php
$sqll = "SELECT count(*) as total from stock_issue where ohc_location_id ='$location' and amb_no_box_code ='$amb_no_box_code' and issue_ohc_type_id='" . $_SESSION['current_ohcttype'] . "' and issue_date BETWEEN STR_TO_DATE('" . $start . "','%d-%m-%Y') and STR_TO_DATE('" . $end . "','%d-%m-%Y') ";
$result_sqll = mysqli_query($conn, $sqll);
$num_rows = mysqli_num_rows($result_sqll);
$row0 = mysqli_fetch_assoc($result_sqll);
error_log("total:" . $sqll);
$sql = "SELECT filled_by ,stock_issue_emp_id, stock_issue_id, issue_ref_no,req_id,issue_date,remarks,ohc_location_id,amb_no_box_code,status from stock_issue where ohc_location_id ='$location' and amb_no_box_code ='$amb_no_box_code' and issue_ohc_type_id='" . $_SESSION['current_ohcttype'] . "' and issue_date BETWEEN STR_TO_DATE('" . $start . "','%d-%m-%Y') and STR_TO_DATE('" . $end . "','%d-%m-%Y') ";
error_log('tooo' . $sql);
$result = mysqli_query($conn, $sql);
?>
<strong>
<tr bgcolor="#eeeeee">
<td align="left" width="2%">Sr.</td>
<td align="left" width="2%">Issue Ref No</td>
<td align="left" width="2%">Issue Date</td>
<td align="left" width="2%">Issue By</td>
<td align="left" width="2%">Requested Items</td>
</tr>
<?php
$count = 1;
while ($row1 = mysqli_fetch_assoc($result)) {
@extract($row1);
// error_log($row1['employer_contractor_id']);
?>
<tr>
<td><?php echo $count ?></td>
<?php $issue_ref_no = "<a target=\"_blank\" href=\"issue_pdf.php?stock_issue_id=" . $id . "\">" . $row1['issue_ref_no'] . "</a>"; ?>
<td><?php echo $issue_ref_no; ?></td>
<td><?php echo date_format(date_create($row1['issue_date']), "d-M-Y "); ?></td>
<?php $nameissu = getTableFieldValue('patient_master', 'patient_name', 'id', $row1['filled_by']); ?>
<td><?php echo $nameissu ; ?></td>
<?php
$sql_issue_items = "select * from stock_issue_items where stock_issue_id='" . $row1['stock_issue_id'] . "' $AndOhcFilter ";
$results_issue_items = mysqli_query($conn, $sql_issue_items);
while ($row_issue_items = mysqli_fetch_assoc($results_issue_items)) {
$item_desc = $item_desc . ' <p> ' . getItemWithFormName($row_issue_items['item_id']) . " ";
//$item_desc = $item_desc.getTableFieldValue('tbl_items','item_name','item_id',$row_issue_items['item_id'])."<br/>";
$item_unit_id = getTableFieldValue('tbl_items', 'unit_id', 'item_id', $row_issue_items['item_id']);
$item_unit = getTableFieldValue('unit_master', 'unit_name', 'unit_id', $item_unit_id);
// $issuby = getTableFieldValue('patient_master' , 'patient_name' , 'id' , $row_issue_items['stock_issue_emp_id']);
error_log("Userid " . $issuby);
$item_desc = $item_desc . '<b> Qty: ' . $row_issue_items['issue_qty'] . ' ' . $item_unit . '</b>';
$item_desc = $item_desc . "</p>";
}
?>
<td><?php echo $item_desc; ?></td>
</tr>
<?php
$count++;
}
?>
<tr Height="10px">
<td colspan="29"><b>TOTAL: &nbsp;<?php echo $row0['total'] ?></b></td>
</tr>
</table>
</body>
<script>
$(document).ready(function() {
window.print();
});
</script>