?>
</td>
                <td><?php 
    echo $record['quantity'];
    ?>
</td>
                <td><?php 
    echo DhsHelper::formatPrice($con, $record['total']);
    ?>
</td>
                <td><?php 
    echo $record['payment_mode'];
    ?>
</td>
                <td><?php 
    echo DhsHelper::formatDate($record['created_date']);
    ?>
</td>
                <td>
                	
                	
                	<a href="admin/paid_bill_print.php" onclick="javascript:void window.open('admin/paid_bill_print.php?bill_id=<?php 
    echo $record['bill_id'];
    ?>
', '', 'width=980, height=600, toolbar=0, menubar=0, location=0, status=1, scrollbars=1, resizable=1, left=0, top=0'); return false;">
                        <i class="icon-print"></i>
                	</a>
                	
                	<a href="#" class="cust_delete" data-source-id="<?php 
    echo $record['bill_id'];
    ?>
  <div class="control-group">
    <label class="control-label" for="mfg_date">Manufactured Date:</label>
    <div class="controls">
      <input type="text" id="mfg_date" name="mfg_date" placeholder="Manufactured Date" value="<?php 
echo DhsHelper::formatDate($record['mfg_date']);
?>
" readonly="readonly" />
  	</div>
  </div>
  
        
  <div class="control-group">
    <label class="control-label" for="expiry_date">Expiry Date:</label>
    <div class="controls">
      <input type="text" id="expiry_date" name="expiry_date" placeholder="Expiry Date" value="<?php 
echo DhsHelper::formatDate($record['expiry_date']);
?>
" readonly="readonly" />
  </div></div>
  
  <div class="control-group">
    <label class="control-label" for="verify">Do Verify:</label>
    <div class="controls">
      <input type="radio" name="verify" value="1" checked="checked">Yes
      <input type="radio" name="verify" value="0" <?php 
echo isset($verify) && $verify == 0 ? 'checked="checked"' : '';
?>
>No
  	</div>
  </div>
  
    ?>
</td>
	              <td><?php 
    echo DhsHelper::formatPrice($row['unit_cost']);
    ?>
</td>
	              <td><?php 
    echo DhsHelper::formatPrice($row['subtotal']);
    ?>
</td>
	              <td><?php 
    echo DhsHelper::formatDate($row['mfg_date']);
    ?>
</td>
	              <td><?php 
    echo DhsHelper::formatDate($row['expiry_date']);
    ?>
</td>
	              <td><?php 
    echo DhsHelper::formatPrice($row['total']);
    ?>
</td>
	              <td>
	              	<?php 
    if ($a > 0) {
        ?>
	              	<a href="<?php 
        echo DHS_ROOT;
        ?>
index.php?view=return_stock&menu=medicine&medicine_id=<?php 
        echo $row['medicine_id'];
        ?>
			<tr><td><?php 
        echo ++$index;
        ?>
</td>
			<td><?php 
        echo $row['purpose'];
        ?>
</td>
			<td>Rs. <?php 
        echo DhsHelper::formatPrice($con, $row['amount']);
        ?>
</td>
            
            <td><?php 
        echo DhsHelper::formatDate($row['created_date']);
        ?>
			<!--<td>
				<a href="index.php?view=expense_registration&menu=accounting&action=update_expense&expense_id=<?php 
        //echo $row['expenditure_id'];
        ?>
">
					<i class="icon-edit"></i>
				</a>
				<a href="#" class="expense_delete" data-source-id="<?php 
        //echo $row['expenditure_id'];
        ?>
">
                        <i class="icon-remove"></i>
                	</a>
                	
     $sql = "update `medicine` set `medicine_name`= '{$medicine}', `category_id`= {$cat_id}, `ingrediants` = '{$inge}', `is_generic` = {$generic}, `manufacturer` = '{$mfgr}' where `medicine_id` = {$medicine_id}";
     if (!mysqli_query($con, $sql)) {
         die('Error' . mysql_error());
     }
     break;
 case "select_medicine":
     $sql = 'select m.medicine_name, invt.* from medicine as m inner join (select * from `inventory` ';
     $sql .= 'where `store_key` = ' . "'" . $store_key . "'" . ' and `status` = ' . DHS_DISTRIBUTOR_INVENTORY_STATUS_VERIFIED;
     $sql .= " and `barcode` = {$barcode} ) as invt on (m.medicine_id = invt.medicine_id)";
     $result = mysqli_query($con, $sql);
     $record = mysqli_fetch_array($result);
     $record['unit_cost'] = DhsHelper::formatPrice($record['unit_cost']);
     $record['subtotal'] = DhsHelper::formatPrice($record['subtotal']);
     $record['total'] = DhsHelper::formatPrice($record['total']);
     $record['mfg_date'] = DhsHelper::formatDate($record['mfg_date'], 'Y-m-d');
     $record['expiry_date'] = DhsHelper::formatDate($record['expiry_date'], 'Y-m-d');
     //$sold_rs = mysqli_query($con,'select sum(quantity) as sold from `cust_inventory` group by `barcode` where ');
     echo '####' . json_encode($record) . '@@@@';
     die;
     break;
 case "barcode_medicine":
     $records = DhsHelper::getBarcodeDetails($barcode, $store_key);
     echo '####' . json_encode($records) . '@@@@';
     die;
     break;
 case "delete_medicine":
     $id = $_REQUEST['medicine_id'];
     if (!empty($id)) {
         $sql = "update `medicine` set status=0 where medicine_id={$id}";
         if (!($rs = mysqli_query($con, $sql))) {
             die('Error' . mysql_error());
Exemple #6
0
 public function inventory_details($request)
 {
     $compulsory = array('storeid', 'medicine_id');
     $data = self::processRequestData($request, $compulsory, array());
     if (!is_array($data)) {
         return array('success_code' => '404', 'result' => $data);
     }
     $store_key = $data['storeid'];
     $medicine_id = $data['medicine_id'];
     $result = mysqli_query($con, "select medicine.medicine_name, inventory.* from `medicine` inner join\n\t\t\t\t(select * from inventory where `store_key` = '{$store_key}' and status = 30 and medicine_id = {$medicine_id}) as inventory \n\t\t\t\ton (medicine.`medicine_id` = inventory.`medicine_id`)");
     $inventory = array();
     while ($row = mysqli_fetch_array($result)) {
         $barcode = $row['barcode'];
         $sql = 'SELECT ';
         $sql .= '( ';
         $sql .= "(select COALESCE(`quantity`, 0) from `inventory` where `barcode` = {$barcode} and status = " . DHS_DISTRIBUTOR_INVENTORY_STATUS_VERIFIED . ") ";
         $sql .= " - ";
         $sql .= "(select COALESCE(sum(`quantity`), 0) as quantity from `cust_inventory` where `barcode` = {$barcode}) ";
         $sql .= ' - ';
         $sql .= "(select COALESCE(sum(`quantity`), 0) as quantity from `return_stock` where `barcode` = {$barcode} and status <> 0) ";
         $sql .= ') as remaining';
         $res = mysqli_query($con, $sql);
         $rem = mysqli_fetch_array($res);
         $i['available_quantity'] = $rem['remaining'];
         $i['medicine_name'] = $row['medicine_name'];
         $i['barcode'] = $row['barcode'];
         $i['unit_cost'] = DhsHelper::formatPrice($row['unit_cost']);
         $i['subtotal'] = DhsHelper::formatPrice($row['subtotal']);
         $i['mfg_date'] = DhsHelper::formatDate($row['mfg_date']);
         $i['expiry_date'] = DhsHelper::formatDate($row['expiry_date']);
         $i['total'] = DhsHelper::formatPrice($row['total']);
         $i['medicine_id'] = $row['medicine_id'];
         $i['distributor_id'] = $row['distributor_id'];
         $i['inventory_id'] = $row['inventory_id'];
         $inventory[] = $i;
     }
     return array('success_code' => '200', 'result' => $inventory);
 }
        ?>
</td>
			<td><?php 
        echo $row['medicine_name'];
        ?>
</td>
			<td><?php 
        echo $category[$row['category_id']];
        ?>
</td>
			<td><?php 
        echo $row['requested_quantity'];
        ?>
</td>
			<td><?php 
        echo DhsHelper::formatDate($row['requested_date']);
        ?>
</td>
			<td><a class="btn btn-small btn-danger" target="_blank" href="index.php?view=process_stock_request&menu=requests&inventory_id=<?php 
        echo $row['inventory_id'];
        ?>
&store_key=<?php 
        echo $store_key;
        ?>
">Done</a></td>
		</tr>
		
	<?php 
    }
}
?>
		        Contact No: <?php 
echo $customer_mob;
?>
.
	        </div>
     	</div>
       
       <div class="span6" style="text-align: right;">
       		<b>Details</b><br />
	        <div>
		        Bill Id	: <?php 
echo $bill_id;
?>
<br>
		        Billing Date : <?php 
echo DhsHelper::formatDate($created_date);
?>
<br>
		       <!-- Doctor Name: <?php 
//echo $doctor_name;
?>
<br>-->
	        </div>
       		
       </div>
      
     </div>
     
     <div class="set-height">&nbsp;</div>
     <div class="set-height">&nbsp;</div>
     
        ?>
				<tr>
					<td><?php 
        echo $row['medicine_name'];
        ?>
</td>
					<td><?php 
        echo $row['quantity'];
        ?>
</td>
					<td><?php 
        echo DhsHelper::formatPrice($row['total']);
        ?>
</td>
					<td><?php 
        echo DhsHelper::formatDate($row['created_date'], 'd-M-Y');
        ?>
</td>
				</tr>
				<?php 
    }
    ?>
			</tbody>
		</table>
		
		<div class="well well-small">
			<strong>Total Business: Rs. <?php 
    echo DhsHelper::formatPrice($total);
    ?>
</strong>
		</div>
        ?>
</td>
			<td><?php 
        echo $row['requested_quantity'];
        ?>
</td>
			<td><?php 
        echo $row['quantity'];
        ?>
</td>
			<td><?php 
        echo DhsHelper::formatDate($row['requested_date']);
        ?>
</td>
			<td><?php 
        echo DhsHelper::formatDate($row['completed_date']);
        ?>
</td>
			<td><?php 
        echo $row['message'];
        ?>
</td>
			<td>
			<?php 
        if ($row['status'] == 30) {
            ?>
				Verifed
			<?php 
        } else {
            ?>