Ejemplo n.º 1
0
function add_product_serial_number($array)
{
    $ci =& get_instance();
    $query = get_product_serial_number($array);
    if ($query) {
        return 0;
    } else {
        $ci->db->insert('product_serials', $array);
        return $query = $ci->db->insert_id();
    }
}
Ejemplo n.º 2
0
</div> <!-- /.row -->


</div><!-- /#product card -->



<!-- serial -->
<div class="tab-pane fade in" id="serial_box">

<?php 
if (isset($_POST['add_serial_number'])) {
    $serial['status'] = '1';
    $serial['product_id'] = $product_id;
    $serial['serial'] = $this->input->post('serial_number');
    $is_serial = get_product_serial_number($serial);
    if ($is_serial == 0) {
        $serial_id = add_product_serial_number($serial);
        if ($serial_id > 0) {
            alertbox('alert-success', get_lang('Data Added'));
        }
    } else {
        alertbox('alert-warning', '[' . $serial['serial'] . '] ' . get_lang('The serial number exists in the database.'));
    }
    echo '<script>$("#tab_serial_click").click(); $("#serial_number").click();</script>';
}
if (isset($_GET['delete_serial'])) {
    $serial_id = $_GET['serial_id'];
    $this->db->where('id', $serial_id);
    $this->db->update('product_serials', array('status' => '0'));
    if ($this->db->affected_rows() > 0) {
Ejemplo n.º 3
0
     $data['product_id'] = $product['id'];
     $data['account_id'] = $invoice['account_id'];
     $data['title'] = get_lang('Product Added');
     if ($invoice['in_out'] == 0) {
         $data['description'] = get_lang('Product purchase.');
     } else {
         $data['description'] = get_lang('Product sales.');
     }
     add_log($data);
     alertbox('alert-success', get_lang('Add a successful product.'));
     calc_invoice_items($invoice['id']);
     // serial control
     if ($product['serial'] == 1) {
         $serial['serial'] = $this->input->post('serial');
         if ($serial > 0) {
             $is_serial = get_product_serial_number(array('status' => '1', 'product_id' => $product['id'], 'serial' => $serial['serial']));
             if ($is_serial > 0) {
                 $this->db->where('id', $is_serial['id']);
                 $this->db->update('product_serials', array('invoice_id' => $invoice_id));
                 // update item serial number
                 $this->db->where('id', $item_id);
                 $this->db->update('invoice_items', array('product_serial_id' => $is_serial['id']));
             } else {
                 add_product_serial_number(array('status' => 1, 'product_id' => $product['id'], 'serial' => $serial['serial'], 'invoice_id' => $invoice['id']));
                 // update item serial number
                 $this->db->where('id', $item_id);
                 $this->db->update('invoice_items', array('product_serial_id' => $is_serial['id']));
             }
         }
     }
 }