示例#1
0
 public static function arrived_stock($request)
 {
     $compulsory = array('storeid');
     $data = self::processRequestData($request, $compulsory, array());
     if (!is_array($data)) {
         return array('success_code' => '404', 'result' => $data);
     }
     $store_key = $data['storeid'];
     $result = mysqli_query($con, "select * from `inventory` where `store_key` = '{$store_key}' and status = " . DHS_DISTRIBUTOR_INVENTORY_STATUS_COMPLETED);
     $index = 0;
     $inventory = array();
     $medicines = array();
     $distributor = array();
     $records = array();
     while ($record = mysqli_fetch_array($result)) {
         $records[] = $record;
         $medicines[] = $record['medicine_id'];
         $distributor[] = $record['distributor_id'];
     }
     $medicine_details = DhsHelper::getMedicinesList($medicines);
     $distributors = DhsHelper::getDistributorsList($distributor);
     foreach ($records as $record) {
         $inventory_id = $record['inventory_id'];
         $i = array();
         $i['inventory_id'] = $inventory_id;
         $i['medicine_name'] = $medicine_details[$record['medicine_id']];
         $i['requested_quantity'] = $record['requested_quantity'];
         $i['arrived_quantity'] = $record['quantity'];
         $i['sent_on'] = $record['completed_date'];
         $i['distributor_name'] = $distributors[$record['distributor_id']];
         $i['barcode'] = $record['barcode'];
         $i['requested_quantity'] = $record['requested_quantity'];
         $i['arrived_quantity'] = $record['quantity'];
         $i['unit_cost'] = $record['buy_unit_cost'];
         $i['subtotal'] = $record['subtotal'];
         $i['tax'] = $record['tax'];
         $i['discount'] = $record['discount'];
         $i['total'] = $record['total'];
         $i['mfg_date'] = $record['mfg_date'];
         $i['exp_date'] = $record['expiry_date'];
         $inventory[] = $i;
     }
     return array('success_code' => '200', 'result' => $inventory);
 }
?>
" />
    </div>
  </div>
  <?php 
$get_data = 'SELECT * FROM `medicine` INNER JOIN `category` ON (category.category_id=medicine.category_id and medicine_id = ' . $record['medicine_id'] . ')';
$value_data = mysqli_query($con, $get_data);
if (!$value_data) {
    die('' . mysql_error());
}
?>
   <div class="control-group">
    <label class="control-label" for="name">Medicine Name:</label>
    <div class="controls">
    	<?php 
$medicine = DhsHelper::getMedicinesList(array($record['medicine_id']));
?>
    	<input type="text" id="medicine_name" name="medicine_name" placeholder="medicine_name" readonly="readonly" value="<?php 
echo $medicine[$record['medicine_id']];
?>
">
        <input type="hidden" name="medicine_id" value="<?php 
echo $record['medicine_id'];
?>
" />
    </div>
  </div>
  
  <div class="control-group">
    <label class="control-label" for="name">Medicine Barcode:</label>
    <div class="controls">
示例#3
0
			<?php 
$store_key = $_SESSION['mystoreid'];
$result = mysqli_query($con, "select r.*, m.medicine_name from `return_stock` as r join `medicine` as m on (r.medicine_id = m.medicine_id and r.store_key = '{$store_key}' and m.store_key = '{$store_key}' and r.status <> 0)");
$index = 0;
$records = array();
$medicines = array();
$users = array();
$distributors = array();
while ($row = mysqli_fetch_array($result)) {
    $records[] = $row;
    $medicines[] = $row['medicine_id'];
    $users[] = $row['returned_by'];
    $distributors[] = $row['distributor_id'];
}
$users_list = DhsHelper::getUsersList($users);
$medicines_list = DhsHelper::getMedicinesList($medicines);
$distributor_list = DhsHelper::getDistributorsList($distributors);
foreach ($records as $record) {
    ?>
			<tr>
				<td><?php 
    echo ++$index;
    ?>
</td>
				<td><?php 
    echo isset($medicines_list[$record['medicine_id']]) ? $medicines_list[$record['medicine_id']] : 'N/A';
    ?>
</td>
				<td><?php 
    echo $record['quantity'];
    ?>