ok
Direktori : /home2/selectio/www/mm-tailor-billing/app/controllers/ |
Current File : //home2/selectio/www/mm-tailor-billing/app/controllers/Sales-Copy-2.php |
<?php if (!defined('BASEPATH')) { exit('No direct script access allowed'); } /*UPDATE `tec_sales` SET cutting_status="1", stitching_status="1", ready_to_delivery_status="1", order_delivery_status="1"; UPDATE `tec_sales` SET unit_process_status="1"; UPDATE `tec_sale_items` SET cutting_status="1", stitching_status="1", ready_products_status="1", delivery_date_status="1";*/ class Sales extends MY_Controller { public function __construct() { parent::__construct(); if (!$this->loggedIn) { redirect('login'); } if (!$this->session->userdata('store_id')) { $this->session->set_flashdata('warning', lang('please_select_store')); redirect('stores'); } $this->load->library('form_validation'); $this->load->model('sales_model'); $this->digital_file_types = 'zip|pdf|doc|docx|xls|xlsx|jpg|png|gif'; } public function add_payment($id = null, $cid = null) { $this->load->helper('security'); if ($this->input->get('id')) { $id = $this->input->get('id'); } $this->form_validation->set_rules('amount-paid', lang('amount'), 'required'); $this->form_validation->set_rules('paid_by', lang('paid_by'), 'required'); $this->form_validation->set_rules('userfile', lang('attachment'), 'xss_clean'); if ($this->form_validation->run() == true) { if ($this->Admin) { $date = $this->input->post('date'); } else { $date = date('Y-m-d H:i:s'); } $payment = [ 'date' => $date, 'sale_id' => $id, 'customer_id' => $cid, 'reference' => $this->input->post('reference'), 'amount' => $this->input->post('amount-paid'), 'paid_by' => $this->input->post('paid_by'), 'cheque_no' => $this->input->post('cheque_no'), 'gc_no' => $this->input->post('gift_card_no'), 'cc_no' => $this->input->post('pcc_no'), 'cc_holder' => $this->input->post('pcc_holder'), 'cc_month' => $this->input->post('pcc_month'), 'cc_year' => $this->input->post('pcc_year'), 'cc_type' => $this->input->post('pcc_type'), 'note' => $this->input->post('note'), 'created_by' => $this->session->userdata('user_id'), 'store_id' => $this->session->userdata('store_id'), ]; $status = $this->input->post('paid'); if ($_FILES['userfile']['size'] > 0) { $this->load->library('upload'); $config['upload_path'] = 'files/'; $config['allowed_types'] = $this->digital_file_types; $config['max_size'] = 2048; $config['overwrite'] = false; $config['encrypt_name'] = true; $this->upload->initialize($config); if (!$this->upload->do_upload()) { $error = $this->upload->display_errors(); $this->session->set_flashdata('error', $error); redirect($_SERVER['HTTP_REFERER']); } $photo = $this->upload->file_name; $payment['attachment'] = $photo; } // $this->tec->print_arrays($payment); } elseif ($this->input->post('add_payment')) { $this->session->set_flashdata('error', validation_errors()); $this->tec->dd(); } if ($this->form_validation->run() == true && $this->sales_model->addPayment($payment)) { $this->sales_model->addPaymentStatus($status,$id); $this->session->set_flashdata('message', lang('payment_added')); redirect($_SERVER['HTTP_REFERER']); } else { $this->data['error'] = (validation_errors() ? validation_errors() : $this->session->flashdata('error')); $sale = $this->sales_model->getSaleByID($id); $this->data['inv'] = $sale; $this->load->view($this->theme . 'sales/add_payment', $this->data); } } public function delete($id = null) { if (DEMO) { $this->session->set_flashdata('error', lang('disabled_in_demo')); redirect($_SERVER['HTTP_REFERER'] ?? 'welcome'); } if ($this->input->get('id')) { $id = $this->input->get('id'); } if (!$this->Admin) { $this->session->set_flashdata('error', lang('access_denied')); redirect('sales'); } if ($this->sales_model->deleteInvoice($id)) { $this->session->set_flashdata('message', lang('invoice_deleted')); redirect('sales'); } } public function assigned_delete($id = null) { if ($this->input->get('id')) { $id = $this->input->get('id'); } if (!$this->Admin) { $this->session->set_flashdata('error', lang('access_denied')); redirect('sales'); } if ($this->sales_model->deleteAssignList($id)) { $this->session->set_flashdata('message', lang('Assigned List Deleted Successfully')); redirect('sales'); } } public function delete_holded($id = null) { if ($this->input->get('id')) { $id = $this->input->get('id'); } if (!$this->Admin) { $this->session->set_flashdata('error', lang('access_denied')); redirect('sales/opened'); } if ($this->sales_model->deleteOpenedSale($id)) { $this->session->set_flashdata('message', lang('opened_bill_deleted')); redirect('sales/opened'); } } public function delete_payment($id = null) { if ($this->input->get('id')) { $id = $this->input->get('id'); } if (!$this->Admin) { $this->session->set_flashdata('error', lang('access_denied')); redirect($_SERVER['HTTP_REFERER']); } if ($this->sales_model->deletePayment($id)) { $this->session->set_flashdata('message', lang('payment_deleted')); redirect('sales'); } } // New Function Starst Here function customerInfo() { $customer_id = $this->input->get('sale_id'); $customer_details = $this->sales_model->getSaleByCusID($customer_id); echo json_encode($customer_details); } function deleteAssign() { $id = $this->input->get('id'); $this->sales_model->deleteAssignList($id); } function saleItemsInfo() { $sales_id = $this->input->get('sale_id'); $sale_items_details = $this->sales_model->getSaleIemsBySaleID($sales_id); echo json_encode($sale_items_details); } // New Function Ends Here public function edit_payment($id = null, $sid = null) { if (!$this->Admin) { $this->session->set_flashdata('error', lang('access_denied')); redirect($_SERVER['HTTP_REFERER']); } $this->load->helper('security'); if ($this->input->get('id')) { $id = $this->input->get('id'); } $this->form_validation->set_rules('amount-paid', lang('amount'), 'required'); $this->form_validation->set_rules('paid_by', lang('paid_by'), 'required'); $this->form_validation->set_rules('userfile', lang('attachment'), 'xss_clean'); if ($this->form_validation->run() == true) { $payment = [ 'sale_id' => $sid, 'reference' => $this->input->post('reference'), 'amount' => $this->input->post('amount-paid'), 'paid_by' => $this->input->post('paid_by'), 'cheque_no' => $this->input->post('cheque_no'), 'gc_no' => $this->input->post('gift_card_no'), 'cc_no' => $this->input->post('pcc_no'), 'cc_holder' => $this->input->post('pcc_holder'), 'cc_month' => $this->input->post('pcc_month'), 'cc_year' => $this->input->post('pcc_year'), 'cc_type' => $this->input->post('pcc_type'), 'note' => $this->input->post('note'), 'updated_by' => $this->session->userdata('user_id'), 'updated_at' => date('Y-m-d H:i:s'), ]; if ($this->Admin) { $payment['date'] = $this->input->post('date'); } if ($_FILES['userfile']['size'] > 0) { $this->load->library('upload'); $config['upload_path'] = 'files/'; $config['allowed_types'] = $this->digital_file_types; $config['max_size'] = 2048; $config['overwrite'] = false; $config['encrypt_name'] = true; $this->upload->initialize($config); if (!$this->upload->do_upload()) { $error = $this->upload->display_errors(); $this->session->set_flashdata('error', $error); redirect($_SERVER['HTTP_REFERER']); } $photo = $this->upload->file_name; $payment['attachment'] = $photo; } //$this->tec->print_arrays($payment); } elseif ($this->input->post('edit_payment')) { $this->session->set_flashdata('error', validation_errors()); $this->tec->dd(); } if ($this->form_validation->run() == true && $this->sales_model->updatePayment($id, $payment)) { $this->session->set_flashdata('message', lang('payment_updated')); redirect('sales'); } else { $this->data['error'] = (validation_errors() ? validation_errors() : $this->session->flashdata('error')); $payment = $this->sales_model->getPaymentByID($id); if ($payment->paid_by != 'cash') { $this->session->set_flashdata('error', lang('only_cash_can_be_edited')); $this->tec->dd(); } $this->data['payment'] = $payment; $this->load->view($this->theme . 'sales/edit_payment', $this->data); } } public function get_opened_list() { $this->load->library('datatables'); if ($this->db->dbdriver == 'sqlite3') { $this->datatables->select("id, date, customer_name, hold_ref, (total_items || ' (' || total_quantity || ')') as items, grand_total", false); } else { $this->datatables->select("id, date, customer_name, hold_ref, CONCAT(total_items, ' (', total_quantity, ')') as items, grand_total", false); } $this->datatables->from('suspended_sales'); if (!$this->Admin) { $user_id = $this->session->userdata('user_id'); $this->datatables->where('created_by', $user_id); } $this->datatables->where('store_id', $this->session->userdata('store_id')); $this->datatables->add_column( 'Actions', "<div class='text-center'><div class='btn-group'><a href='" . site_url('pos/?hold=$1') . "' title='" . lang('click_to_add') . "' class='tip btn btn-info btn-xs'><i class='fa fa-th-large'></i></a> <a href='" . site_url('sales/delete_holded/$1') . "' onClick=\"return confirm('" . lang('alert_x_holded') . "')\" title='" . lang('delete_sale') . "' class='tip btn btn-danger btn-xs'><i class='fa fa-trash-o'></i></a></div></div>", 'id' ) ->unset_column('id'); echo $this->datatables->generate(); } public function get_sales() { $customer = $this->input->get('customer') ? $this->input->get('customer') : NULL; $start_date = $this->input->get('start_date') ? $this->input->get('start_date') : NULL; $end_date = $this->input->get('end_date') ? $this->input->get('end_date') : NULL; $user = $this->input->get('user') ? $this->input->get('user') : NULL; $sells = $this->input->get('sells') ? $this->input->get('sells') : NULL; //$hold_ref=array(); //error_log("DC Number:".$this->input->get('hold_ref')); $hold_ref = $this->input->get('hold_ref'); // multiple dc numbers //$hold_ref = implode(",", $this->input->post('hold_ref')) ? $this->input->get('hold_ref') : NULL; // error_log("DC Number:".$hold_ref); $destination_array = explode(',', $hold_ref); /*foreach($destination_array as $e){ error_log("<br>DC Numbers:".$e); }*/ $status = $this->input->get('process_status') ? $this->input->get('process_status') : NULL; $payment = $this->input->get('payment') ? $this->input->get('payment') : NULL; $this->load->library('datatables'); if ($this->db->dbdriver == 'sqlite3') { $this->datatables->select("tec_sales.id, DATE_FORMAT(date, '%d-%m-%Y') as date, customer_name, customer_phone_no, hold_ref, total, total_tax, total_discount, grand_total, paid, status, DATE_FORMAT(deliver_date, '%d-%m-%Y') as deliver_date, DATE_FORMAT(due_date, '%d-%m-%Y') as due_date, DATE_FORMAT(sale_date, '%d-%m-%Y') as sale_date, total_items,unit_process_status, (SELECT FORMAT((SUM(tec_sale_items.quantity)),0) from tec_sale_items where tec_sale_items.sale_id=tec_sales.id and tec_sale_items.product_id=1) as pant_count,(SELECT FORMAT((SUM(tec_sale_items.quantity)),0) from tec_sale_items where tec_sale_items.sale_id=tec_sales.id and tec_sale_items.product_id=2 or tec_sale_items.sale_id=tec_sales.id and tec_sale_items.product_id=3) as shirt_count,sells"); } else { $this->datatables->select("tec_sales.id, DATE_FORMAT(date, '%d-%m-%Y') as date, customer_name, customer_phone_no, hold_ref, total, total_tax, total_discount, grand_total, paid, status, DATE_FORMAT(deliver_date, '%d-%m-%Y') as deliver_date, DATE_FORMAT(due_date, '%d-%m-%Y') as due_date, DATE_FORMAT(sale_date, '%d-%m-%Y') as sale_date, total_items,unit_process_status, (SELECT FORMAT((SUM(tec_sale_items.quantity)),0) from tec_sale_items where tec_sale_items.sale_id=tec_sales.id and tec_sale_items.product_id=1) as pant_count,(SELECT FORMAT((SUM(tec_sale_items.quantity)),0) from tec_sale_items where tec_sale_items.sale_id=tec_sales.id and tec_sale_items.product_id=2 or tec_sale_items.sale_id=tec_sales.id and tec_sale_items.product_id=3) as shirt_count,sells"); } //IF(sells='1','Sales',IF(sells='2','Trails',IF(sells='3','Trail Completed','Undefined'))) as sale_type_name $this->datatables->from('sales'); if (!$this->Admin && !$this->session->userdata('view_right')) { $this->datatables->where('created_by', $this->session->userdata('user_id')); /*$this->datatables->where('sells', '1');*/ } $this->datatables->where('store_id', $this->session->userdata('store_id')); /*$this->datatables->where('sells', '1');*/ //$this->datatables->join('tec_sale_items', 'tec_sales.id = tec_sale_items.sale_id','inner'); $this->datatables->add_column('Clone', "<div class='text-center'><a href='" . site_url('pos/?clone=$1') . "' title='" . lang('view_invoice') . "' target='_blank' class='tip btn btn-success btn-xs'>Clone <i class='fa fa-copy'></i></a> </div>", 'id'); $this->datatables->add_column('Actions', "<div class='text-center'><div class='btn-group'><span title='Send SMS' id='$1' class='tip btn btn-info btn-xs sms'><i class='fa fa-envelope-o'></i></span><span title='History' id='$1' class='tip btn btn-warning btn-xs view-history'><i class='fa fa-history'></i></span><a href='" . site_url('pos/view/$1/1') . "' title='" . lang('view_invoice') . "' class='tip btn btn-primary btn-xs' data-toggle='ajax-modal'><i class='fa fa-list'></i></a> <a href='" . site_url('sales/payments/$1') . "' title='" . lang('view_payments') . "' class='tip btn btn-primary btn-xs' data-toggle='ajax'><i class='fa fa-money'></i></a> <a href='" . site_url('sales/add_payment/$1') . "' title='" . lang('add_payment') . "' class='tip btn btn-primary btn-xs' data-toggle='ajax'><i class='fa fa-briefcase'></i></a> <a href='" . site_url('pos/?edit=$1') . "' title='" . lang('edit_invoice') . "' class='tip btn btn-warning btn-xs'><i class='fa fa-edit'></i></a> <a href='" . site_url('sales/delete/$1') . "' onClick=\"return confirm('" . lang('alert_x_sale') . "')\" title='" . lang('delete_sale') . "' class='tip btn btn-danger btn-xs'><i class='fa fa-trash-o'></i></a></div></div>", 'id'); $this->datatables->edit_column('sale_type_name', "<div class='text-center'><b style='color: red;'><b>$1</div>",'sale_type_name'); if($customer) { $this->datatables->where('customer_id', $customer); } if($user) { $this->datatables->where('created_by', $user); } if($sells) { $this->datatables->where('sells', $sells); } if($start_date) { $this->datatables->where('due_date >=', $start_date); } if($end_date) { $this->datatables->where('due_date <=', $end_date); } //if($hold_ref) { $this->datatables->where('hold_ref', $hold_ref); } //$hold_ref=array(); if($hold_ref) { // $hold_ref = "'" . implode ( "', '",$hold_ref) . "'"; // $hold_ref = "'" . implode ( "', '", $hold_ref ) . "'"; $hold_ref='['.$hold_ref.']'; $this->datatables->where_in('hold_ref', $destination_array); // where_in('id', ['20','15','22','42','86']); // $this->datatables->where_in('hold_ref', [780,7865]); //$this->datatables->where_in('hold_ref', ['780','7865']); } if($status) { $this->datatables->where('unit_process_status', $status); } if($payment) { $this->datatables->where('status', $payment); } echo $this->datatables->generate(); } public function index() { // Filter Starts Here if ($this->input->post('customer')) { $start_date = $this->input->post('start_date') ? $this->input->post('start_date') : NULL; $end_date = $this->input->post('end_date') ? $this->input->post('end_date') : NULL; $user = $this->input->post('user') ? $this->input->post('user') : NULL; $hold_ref = $this->input->post('hold_ref') ? $this->input->post('hold_ref') : NULL; $status = $this->input->post('process_status') ? $this->input->post('process_status') : NULL; $payment = $this->input->post('payment') ? $this->input->post('payment') : NULL; $this->data['total_sales'] = $this->sales_model->getTotalCustomerSales($this->input->post('customer'), $user, $start_date, $end_date, $hold_ref, $status, $payment); } // Filter Ends Here $this->data['error'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('error'); $this->data['customers'] = $this->sales_model->getAllCustomers(); $this->data['users'] = $this->sales_model->getAllStaff(); $this->data['sale_items'] = $this->sales_model->getAllSaleItems(id); $this->data['dc_number'] = $this->sales_model->getAllSaleDC(); $this->data['page_title'] = lang('sales'); $bc = [['link' => '#', 'page' => lang('sales')]]; $meta = ['page_title' => lang('sales'), 'bc' => $bc]; $this->page_construct('sales/index', $this->data, $meta); } // Trails Section Starts Here public function trail_sales() { // Filter Starts Here if ($this->input->post('customer')) { $start_date = $this->input->post('start_date') ? $this->input->post('start_date') : NULL; $end_date = $this->input->post('end_date') ? $this->input->post('end_date') : NULL; $user = $this->input->post('user') ? $this->input->post('user') : NULL; $hold_ref = $this->input->post('hold_ref') ? $this->input->post('hold_ref') : NULL; $status = $this->input->post('process_status') ? $this->input->post('process_status') : NULL; $payment = $this->input->post('payment') ? $this->input->post('payment') : NULL; $this->data['total_sales'] = $this->sales_model->getTotalCustomerSales($this->input->post('customer'), $user, $start_date, $end_date, $hold_ref, $status, $payment); } // Filter Ends Here $this->data['error'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('error'); $this->data['customers'] = $this->sales_model->getAllCustomers(); $this->data['users'] = $this->sales_model->getAllStaff(); $this->data['sale_items'] = $this->sales_model->getAllSaleItems(id); $this->data['page_title'] = lang('trail_sales'); $bc = [['link' => '#', 'page' => lang('trail_sales')]]; $meta = ['page_title' => lang('trail_sales'), 'bc' => $bc]; $this->page_construct('sales/trail_sales', $this->data, $meta); } public function get_trail_sales() { $customer = $this->input->get('customer') ? $this->input->get('customer') : NULL; $start_date = $this->input->get('start_date') ? $this->input->get('start_date') : NULL; $end_date = $this->input->get('end_date') ? $this->input->get('end_date') : NULL; $user = $this->input->get('user') ? $this->input->get('user') : NULL; $hold_ref = $this->input->get('hold_ref') ? $this->input->get('hold_ref') : NULL; $status = $this->input->get('process_status') ? $this->input->get('process_status') : NULL; $payment = $this->input->get('payment') ? $this->input->get('payment') : NULL; $this->load->library('datatables'); if ($this->db->dbdriver == 'sqlite3') { $this->datatables->select("id, strftime('%Y-%m-%d %H:%M', date) as date, customer_name, customer_phone_no, hold_ref, total, total_tax, total_discount, grand_total, paid, status, cutting_unit_user, stitching_unit_user, unit_process_status, cutting_unit_com_date, stitching_unit_com_date, deliver_date, DATE_FORMAT(deliver_date, '%d-%m-%Y') as deliver_date, DATE_FORMAT(due_date, '%d-%m-%Y') as due_date, total_items"); } else { $this->datatables->select("id, DATE_FORMAT(date, '%Y-%m-%d %H:%i') as date, customer_name, customer_phone_no, hold_ref, total, total_tax, total_discount, grand_total, paid, status, cutting_unit_user, stitching_unit_user, unit_process_status, cutting_unit_com_date, stitching_unit_com_date, deliver_date, DATE_FORMAT(deliver_date, '%d-%m-%Y') as deliver_date, DATE_FORMAT(due_date, '%d-%m-%Y') as due_date, total_items"); } $this->datatables->from('sales'); if (!$this->Admin && !$this->session->userdata('view_right')) { $this->datatables->where('sells', $this->session->userdata('user_id')); $this->datatables->where('sells', '2'); } $this->datatables->where('store_id', $this->session->userdata('store_id')); $this->datatables->where('sells', '2'); $this->datatables->add_column('Clone', "<div class='text-center'><a href='" . site_url('pos/?clone=$1') . "' title='" . lang('view_invoice') . "' target='_blank' class='tip btn btn-success btn-xs'>Clone <i class='fa fa-copy'></i></a> </div>", 'id'); $this->datatables->add_column('Actions', "<div class='text-center'><div class='btn-group'><a href='" . site_url('pos/view/$1/1') . "' title='" . lang('view_invoice') . "' class='tip btn btn-primary btn-xs' data-toggle='ajax-modal'><i class='fa fa-list'></i></a> <a href='" . site_url('sales/payments/$1') . "' title='" . lang('view_payments') . "' class='tip btn btn-primary btn-xs' data-toggle='ajax'><i class='fa fa-money'></i></a> <a href='" . site_url('sales/add_payment/$1') . "' title='" . lang('add_payment') . "' class='tip btn btn-primary btn-xs' data-toggle='ajax'><i class='fa fa-briefcase'></i></a> <a href='" . site_url('pos/?edit=$1') . "' title='" . lang('edit_invoice') . "' class='tip btn btn-warning btn-xs'><i class='fa fa-edit'></i></a> <a href='" . site_url('sales/delete/$1') . "' onClick=\"return confirm('" . lang('alert_x_sale') . "')\" title='" . lang('delete_sale') . "' class='tip btn btn-danger btn-xs'><i class='fa fa-trash-o'></i></a></div></div>", 'id'); if($customer) { $this->datatables->where('customer_id', $customer); } if($user) { $this->datatables->where('created_by', $user); } if($start_date) { $this->datatables->where('date >=', $start_date); } if($end_date) { $this->datatables->where('date <=', $end_date); } if($hold_ref) { $this->datatables->where('hold_ref', $hold_ref); } if($status) { $this->datatables->where('unit_process_status', $status); } if($payment) { $this->datatables->where('status', $payment); } echo $this->datatables->generate(); } // Trails Section Ends Here public function opened() { $this->data['error'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('error'); $this->data['page_title'] = lang('opened_bills'); $bc = [['link' => '#', 'page' => lang('opened_bills')]]; $meta = ['page_title' => lang('opened_bills'), 'bc' => $bc]; $this->page_construct('sales/opened', $this->data, $meta); } public function payment_note($id = null) { $payment = $this->sales_model->getPaymentByID($id); $inv = $this->sales_model->getSaleByID($payment->sale_id); $this->data['customer'] = $this->site->getCompanyByID($inv->customer_id); $this->data['inv'] = $inv; $this->data['payment'] = $payment; $this->data['page_title'] = $this->lang->line('payment_note'); $this->load->view($this->theme . 'sales/payment_note', $this->data); } /* -------------------------------------------------------------------------------- */ public function payments($id = null) { $this->data['payments'] = $this->sales_model->getSalePayments($id); $this->load->view($this->theme . 'sales/payments', $this->data); } public function status() { if (!$this->Admin) { $this->session->set_flashdata('warning', lang('access_denied')); redirect('sales'); } $this->form_validation->set_rules('sale_id', lang('sale_id'), 'required'); $this->form_validation->set_rules('status', lang('status'), 'required'); if ($this->form_validation->run() == true) { $this->sales_model->updateStatus($this->input->post('sale_id', true), $this->input->post('status', true)); $this->session->set_flashdata('message', lang('status_updated')); redirect('sales'); } else { $this->session->set_flashdata('error', validation_errors()); redirect('sales'); } } // New Method Update Measurement Starts Here public function up_status_new() { if (!$this->Admin) { $this->session->set_flashdata('warning', lang('access_denied')); redirect('sales'); } $this->form_validation->set_rules('cutting_sale_id', lang('cutting_sale_id'), 'required'); if ($this->form_validation->run() == true) { // New Starts $cutting_sale_id = $this->input->post('cutting_sale_id', true); $update_work_id = array(); $cutting_products =array(); $cutting_username=array(); $cutting_assign_date=array(); $cutting_quantity=array(); $cutting_total_quantity=array(); $cutting_products_name=array(); $new_status=array(); $works_cutting_products=array(); $works_cutting_products_name=array(); $works_cutting_username=array(); $works_cutting_assign_date=array(); $works_cutting_quantity=array(); $works_cutting_total_quantity=array(); $update_work_id = $this->input->post('cutting_update_works_id'); $cutting_products = $this->input->post('cutting_products'); $cutting_products_name = $this->input->post('cutting_products_name'); $cutting_username = $this->input->post('cutting_user_name'); $cutting_assign_date = $this->input->post('cutting_assign_date'); $cutting_quantity = $this->input->post('cutting_quantity'); $cutting_total_quantity = $this->input->post('cutting_total_quantity'); $cutting_status = $this->input->post('cutting_status'); $overall_d_date = $this->input->post('overall_products_delivery_date'); $new_status = $this->input->post('new_status'); $works_cutting_products = $this->input->post('works_cutting_products'); $works_cutting_products_name = $this->input->post('works_cutting_products_name'); $works_cutting_username = $this->input->post('works_cutting_username'); $works_cutting_assign_date = $this->input->post('works_cutting_assign_date'); $works_cutting_quantity = $this->input->post('works_cutting_quantity'); $works_cutting_total_quantity = $this->input->post('works_cutting_total_quantity'); // New Ends $this->sales_model->cuttingUnitStatus($cutting_sale_id, $cutting_products, $cutting_products_name, $cutting_username, $cutting_assign_date, $cutting_quantity, $cutting_total_quantity, $cutting_status, $overall_d_date, $update_work_id, $new_status, $works_cutting_products,$works_cutting_products_name,$works_cutting_username,$works_cutting_assign_date,$works_cutting_quantity,$works_cutting_total_quantity); $this->session->set_flashdata('message', 'Update Successfully...'); redirect('sales'); } else { $this->session->set_flashdata('error', validation_errors()); redirect('sales'); } } public function stitching_new() { if (!$this->Admin) { $this->session->set_flashdata('warning', lang('access_denied')); redirect('sales'); } $this->form_validation->set_rules('cutting_sale_id', lang('cutting_sale_id'), 'required'); if ($this->form_validation->run() == true) { // New Starts $cutting_sale_id = $this->input->post('cutting_sale_id', true); $update_work_id = array(); $cutting_products =array(); $cutting_username=array(); $cutting_assign_date=array(); $cutting_quantity=array(); $cutting_total_quantity=array(); $cutting_products_name=array(); $new_status=array(); $works_cutting_products=array(); $works_cutting_products_name=array(); $works_cutting_username=array(); $works_cutting_assign_date=array(); $works_cutting_quantity=array(); $works_cutting_total_quantity=array(); $update_work_id = $this->input->post('cutting_update_works_id'); $cutting_products = $this->input->post('cutting_products'); $cutting_products_name = $this->input->post('cutting_products_name'); $cutting_username = $this->input->post('cutting_user_name'); $cutting_assign_date = $this->input->post('cutting_assign_date'); $cutting_quantity = $this->input->post('cutting_quantity'); $cutting_total_quantity = $this->input->post('cutting_total_quantity'); $cutting_status = $this->input->post('cutting_status'); $overall_d_date = $this->input->post('overall_products_delivery_date'); $new_status = $this->input->post('new_status'); $works_cutting_products = $this->input->post('works_cutting_products'); $works_cutting_products_name = $this->input->post('works_cutting_products_name'); $works_cutting_username = $this->input->post('works_cutting_username'); $works_cutting_assign_date = $this->input->post('works_cutting_assign_date'); $works_cutting_quantity = $this->input->post('works_cutting_quantity'); $works_cutting_total_quantity = $this->input->post('works_cutting_total_quantity'); // New Ends $this->sales_model->stitchingStatus($cutting_sale_id, $cutting_products, $cutting_products_name, $cutting_username, $cutting_assign_date, $cutting_quantity, $cutting_total_quantity, $cutting_status, $overall_d_date, $update_work_id, $new_status, $works_cutting_products,$works_cutting_products_name,$works_cutting_username,$works_cutting_assign_date,$works_cutting_quantity,$works_cutting_total_quantity); $this->session->set_flashdata('message', 'Update Stithcing Successfully...'); redirect('sales'); } else { $this->session->set_flashdata('error', validation_errors()); redirect('sales'); } } // New Method Update Measurement Endss Here // New Method Update Measurement Starts Here public function stitching_neww() { if (!$this->Admin) { $this->session->set_flashdata('warning', lang('access_denied')); redirect('sales'); } $this->form_validation->set_rules('stitching_sale_id', lang('stitching_sale_id'), 'required'); if ($this->form_validation->run() == true) { $stitching_sale_id = $this->input->post('stitching_sale_id', true); $update_work_id = array(); $stitching_products =array(); $stitching_username=array(); $stitching_assign_date=array(); $stitching_quantity=array(); $stitching_total_quantity=array(); $stitching_products_name=array(); $not_assign_stitching_quantity=array(); $stitching_not_assign_products=array(); $stitching_not_assign_products_name=array(); $stitching_not_assign_total_qty=array(); $new_status=array(); $works_stitching_products=array(); $works_stitching_products_name=array(); $works_stitching_username=array(); $works_stitching_assign_date=array(); $works_stitching_quantity=array(); $works_stitching_total_quantity=array(); $update_work_id = $this->input->post('stitching_update_works_id'); $stitching_products = $this->input->post('stitching_products'); $stitching_products_name = $this->input->post('stitching_products_name'); $stitching_username = $this->input->post('stitching_user_name'); $stitching_assign_date = $this->input->post('stitching_assign_date'); $stitching_quantity = $this->input->post('stitching_quantity'); $stitching_total_quantity = $this->input->post('stitching_total_quantity'); $overall_d_date = $this->input->post('overall_products_delivery_date'); $not_assign_stitching_quantity = $this->input->post('not_assign_stitching_quantity'); $stitching_not_assign_products = $this->input->post('stitching_not_assign_products'); $stitching_not_assign_products_name = $this->input->post('stitching_not_assign_products_name'); $stitching_not_assign_total_qty = $this->input->post('stitching_not_assign_total_qty'); $measurement_status_insert = $this->input->post('measurement_status_insert'); $measurement_status_update = $this->input->post('measurement_status_update'); $new_status = $this->input->post('new_status'); $works_stitching_products = $this->input->post('works_stitching_products'); $works_stitching_products_name = $this->input->post('works_stitching_products_name'); $works_stitching_username = $this->input->post('works_stitching_username'); $works_stitching_assign_date = $this->input->post('works_stitching_assign_date'); $works_stitching_quantity = $this->input->post('works_stitching_quantity'); $works_stitching_total_quantity = $this->input->post('works_stitching_total_quantity'); // New Ends $this->sales_model->stitchingStatus($stitching_sale_id, $stitching_products, $stitching_products_name, $stitching_username, $stitching_assign_date, $stitching_quantity, $stitching_total_quantity, $overall_d_date, $update_work_id, $not_assign_stitching_quantity,$stitching_not_assign_products,$stitching_not_assign_products_name,$stitching_not_assign_total_qty,$new_status, $works_stitching_products,$works_stitching_products_name,$works_stitching_username,$works_stitching_assign_date,$works_stitching_quantity,$works_stitching_total_quantity,$measurement_status_insert,$measurement_status_update); //$this->sales_model->stitchingStatus($sale_id, $products, $products_name, $quantity, $total_quantity, $stitching_user,$stitching_assign_date, $update_work_id, $measurement_status_insert,$measurement_status_update); $this->session->set_flashdata('message', 'Update Stitching Date Successfully...'); redirect('sales'); } else { $this->session->set_flashdata('error', validation_errors()); redirect('sales'); } } public function ready_to_delivery_new() { if (!$this->Admin) { $this->session->set_flashdata('warning', lang('access_denied')); redirect('sales'); } $this->form_validation->set_rules('sale_id', lang('sale_id'), 'required'); if ($this->form_validation->run() == true) { $sale_id = $this->input->post('sale_id', true); $update_work_id = array(); $products =array(); $products_name=array(); $quantity=array(); $total_quantity=array(); $ready_or_not_ready=array(); $not_assign_quantity=array(); $ready_products_not_assign_products=array(); $ready_products_not_assign_products_name=array(); $ready_products_not_assign_total_qty=array(); $update_work_id = $this->input->post('update_works_id'); $products = $this->input->post('products'); $products_name = $this->input->post('products_name'); $quantity = $this->input->post('quantity'); $total_quantity = $this->input->post('total_quantity'); $ready_or_not_ready = $this->input->post('ready_not_ready'); $measurement_status_insert = $this->input->post('measurement_status_insert'); $measurement_status_update = $this->input->post('measurement_status_update'); $not_assign_quantity = $this->input->post('not_assign_quantity'); $ready_products_not_assign_products = $this->input->post('ready_products_not_assign_products'); $ready_products_not_assign_products_name = $this->input->post('ready_products_not_assign_products_name'); $ready_products_not_assign_total_qty = $this->input->post('ready_products_not_assign_total_qty'); $this->sales_model->readyToDeliveryStatus($sale_id, $products, $products_name, $quantity, $total_quantity, $ready_or_not_ready, $update_work_id, $measurement_status_insert, $measurement_status_update, $not_assign_quantity, $ready_products_not_assign_products,$ready_products_not_assign_products_name,$ready_products_not_assign_total_qty); $this->session->set_flashdata('message', 'Update Ready to Delivery Successfully...'); redirect('sales'); } else { $this->session->set_flashdata('error', validation_errors()); redirect('sales'); } } public function delivery_date_new() { if (!$this->Admin) { $this->session->set_flashdata('warning', lang('access_denied')); redirect('sales'); } $this->form_validation->set_rules('sale_id', lang('sale_id'), 'required'); if ($this->form_validation->run() == true) { $sale_id = $this->input->post('sale_id', true); $update_work_id = array(); $products =array(); $products_name=array(); $quantity=array(); $total_quantity=array(); $delivery_date=array(); $update_work_id = $this->input->post('update_works_id'); $products = $this->input->post('products'); $products_name = $this->input->post('products_name'); $quantity = $this->input->post('quantity'); $total_quantity = $this->input->post('total_quantity'); $measurement_status = $this->input->post('measurement_status'); $delivery_date = $this->input->post('delivery_date'); $this->sales_model->deliveryDateStatus($sale_id, $products, $products_name, $quantity, $total_quantity, $measurement_status, $delivery_date, $update_work_id); $this->session->set_flashdata('message', 'Update Delivery Date Successfully...'); redirect('sales'); } else { $this->session->set_flashdata('error', validation_errors()); redirect('sales'); } } public function overall_delivery_date() { if (!$this->Admin) { $this->session->set_flashdata('warning', lang('access_denied')); redirect('sales'); } $this->form_validation->set_rules('delivery_date_sale_id', lang('delivery_date_sale_id'), 'required'); if ($this->form_validation->run() == true) { $sale_id = $this->input->post('delivery_date_sale_id', true);; $full_delivery_date = $this->input->post('full_delivery_date'); $full_delivery_date_status = $this->input->post('full_delivery_date_status'); $this->sales_model->overAllDeliveryStatus($sale_id, $full_delivery_date, $full_delivery_date_status); $this->session->set_flashdata('message', 'Full Products Delivery Date Successfully...'); redirect('sales'); } else { $this->session->set_flashdata('error', validation_errors()); redirect('sales'); } } public function bill_cancel_new() { if (!$this->Admin) { $this->session->set_flashdata('warning', lang('access_denied')); redirect('sales'); } $this->form_validation->set_rules('bill_cancel_sale_id', lang('bill_cancel_sale_id'), 'required'); if ($this->form_validation->run() == true) { $sale_id = $this->input->post('bill_cancel_sale_id', true);; $bill_cancel_status = $this->input->post('bill_cancel_status'); $bill_cancell_done = $this->input->post('bill_cancell_done'); $this->sales_model->billCancelStatus($sale_id, $bill_cancel_status, $bill_cancell_done); $this->session->set_flashdata('message', 'Bill Cancelled Successfully...'); redirect('sales'); } else { $this->session->set_flashdata('error', validation_errors()); redirect('sales'); } } // New Method Update Measurement Endss Here // *********************** Latest NEWWWWWWWWWWWWWWWWW Cutting Status Starts Here ****************************************// public function get_all_sale_cutting_items() { $sales_id = $this->input->get('sale_id'); $date = $this->input->get('date'); $mainsale_datas=$this->sales_model->getSaleMainTable($sales_id); $data=$this->sales_model->getSaleIemsBySaleID($sales_id); $work_units=$this->sales_model->getSaleWorkUnitsTable($sales_id); $sale_works_data=$this->sales_model->getSaleIemsBySaleIDWithWorksTable($sales_id); $user_data = $this->sales_model->getAllStaff(); $content='<div class="row"> <div class="col-md-3"> <label for="products">Products</label> </div> <div class="col-md-3"> <label for="products">Users</label> </div> <div class="col-md-2"> <label for="products">Qty</label> </div> <div class="col-md-3"> <label for="products">Assign Date</label> </div> <div class="col-md-1"> <label for="products">Actions</label> </div> </div>'; if($mainsale_datas){ foreach($mainsale_datas as $salemain){ if($salemain->cutting_status==1){ /********* Cutting Status Starts ************/ $content.='<center><h6>NEWW Cutting Status Not Assign Working</h6></center>'; if($data){ $content.='<input type="hidden" value="'.$sales_id.'" id="cutting_sale_ids" name="cutting_sale_id" /> <input type="hidden" value="2" id="cutting_status" name="cutting_status" />'; foreach($data as $d){ if($d->product_type=="service" && $d->cutting_status=="1"){ $user_content='<option value="0">Select User</option>'; if($user_data){ foreach($user_data as $user){ $user_content.='<option value="'.$user->id.'" '.(($d->cutting_user_id==$user->id)?'selected="selected"':"").'>'.$user->first_name. "" . $user->last_name.'</option>'; } }else{ $user_content.='<option value="">No Data Available</option>'; } $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-3"> <select id="products" name="cutting_products[]" class="form-control tip" style="width:100%;"> <option value="'.$d->product_id.'">'.$d->product_name.'</option> </select> </div>'; $content.='<input type="hidden" name="cutting_not_assign_products[]" value="'.$d->product_id.'" /> <input type="hidden" name="cutting_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"> <input type="hidden" name="cutting_not_assign_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3"> <select id="user_name_'.$d->id.'" name="cutting_user_name[]" class="form-control tip" style="width:100%;"> '.$user_content.' </select> </div>'; $content.='<div class="col-md-2"> <input type="number" id="qty_'.$d->id.'" name="cutting_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip qqty_'.$d->id.' quantity" style="width:100%;" /> </div>'; $content.='<input type="hidden" id="qtty_'.$d->id.'" value="" max="'.number_format("$d->quantity").'" class="form-control" style="width:100%;" /> <input type="hidden" id="tot_'.$d->id.'" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="total" name="cutting_total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" name="cutting_not_assign_total_qty[]" value="'.number_format("$d->quantity").'">'; $content.='<div class="col-md-3"> <input type="date" id="date_'.$d->id.'" value="'.$d->cutting_assign_date.'" name="cutting_assign_date[]" style="padding: 8px;" class="form-control tip today_date"> </div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; if(number_format("$d->quantity")==1){ }else{ $content.='<span id="expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; } $content.='<input type="hidden" id="work_sale_id" value="'.$d->sale_id.'" name="work_sale_id[]" class="form-control work_sale_id" style="width:100%;"> <input type="hidden" id="work_product_id" value="'.$d->product_id.'" name="work_product_id[]" class="form-control work_product_id" style="width:100%;">'; $content.='</div>'; $content.='<div id="expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div>'; $content.='<div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="total_qty_'.$d->product_id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="bal_total_qty_'.$d->product_id.'">Remaining Quantity: <span id="balance_qty_'.$d->product_id.'">0</span></b> </div> </div>'; $content.='</div>'; $content.='<script> $("#expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-3"><select id="products" name="cutting_products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option> </select><input type="hidden" name="cutting_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"></div><div class="col-md-3"><select id="user_name_'.$d->id.'" name="cutting_user_name[]" class="form-control tip" style="width:100%;">'.$user_content.'</select></div><div class="col-md-2"><input type="number" name="cutting_quantity[]" id="qty_'.$d->id.'" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip qqty_'.$d->id.' quantity" style="width:100%;" required /><input type="hidden" id="total" name="cutting_total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /></div><div class="col-md-3"><input type="date" id="date_'.$d->id.'" value="'.$d->cutting_assign_date.'" name="cutting_assign_date[]" style="padding: 8px;" class="form-control tip today_date"></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="expand_remove_'.$d->product_id.'" class="btn btn-danger btn-xs expand_remove_'.$d->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#expand_conteent_'.$d->product_id.'").append(html); }); </script>'; $content.='<script> $(document).ready(function(){ $("#total_qty_'.$d->product_id.'").text('.number_format("$d->quantity").'); }); $(function() { $(document).on("click", ".expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".qqty_'.$d->id.'",function(){ var quantity=Number($(this).val()); grand_total(); }); function grand_total(){ var tot=0; $(".qqty_'.$d->id.'").each(function(){ tot+=Number($(this).val()); var total = $("#tot_'.$d->id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; $("#balance_qty_'.$d->product_id.'").text(grand_balance); $("#baal_total_qty_'.$d->product_id.'").val(grand_balance); $("#qtty_'.$d->id.'").val(grand_balance); if($("#balance_qty_'.$d->product_id.'").text() < 0){ $("#bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#cutting_submit").prop("disabled", true); }else{ $("#bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#cutting_submit").prop("disabled", false); } }); } }); </script><style> .redBackground { background-color: red; } </style>'; } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="cutting_submit" class="btn btn-success" value="Submit"></div>'; } /********* Cutting Status Endss ************/ }else if($salemain->cutting_status==2){ /********* Cutting Status Partial Starts ************/ $content.='<center><h6>Cutting Status Partial Assign Working</h6></center>'; if($work_units){ $content.='<input type="hidden" value="'.$sales_id.'" id="cutting_sale_ids" name="cutting_sale_id" /> <input type="hidden" value="22" id="cutting_status" name="cutting_status" />'; foreach($data as $d){ if($d->product_type=="service" && $d->cutting_status=="0"){ $content.='<div class="row" style="padding: 15px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-3" style="text-align: left;"> <span class="label label-warning" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Product Name: '.$d->product_name.'<span> </div>'; $content.='<div class="col-md-3" style="text-align: center;"> <span class="label label-info btn-sm" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Total Quantity: '.number_format("$d->quantity").'</span> </div>'; $content.='<div class="col-md-3" style="text-align: center;"> <span class="label label-success btn-sm" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Assigned Quantity: '.$d->cutting_assigned.'</span> </div>'; $content.='<div class="col-md-3" style="text-align: center;"> <span class="label label-danger btn-sm" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Balance Quantity: '.$d->remaing_cutting_qty.'</span> </div>'; // New One Starts Here foreach($work_units as $works){ $user_content='<option value="0">Select User</option>'; $new_user_content='<option value="0">Select User</option>'; if($user_data){ foreach($user_data as $user){ $user_content.='<option value="'.$user->id.'" '.(($works->cutting_user_id==$user->id)?'selected="selected"':"").'>'.$user->first_name. "" . $user->last_name.'</option>'; $new_user_content.='<option value="'.$user->id.'">'.$user->first_name. "" . $user->last_name.'</option>'; } }else{ $user_content.='<option value="">No Data Available</option>'; $new_user_content.='<option value="">No Data Available</option>'; } if($works->type=="1" && $works->product_id==$d->product_id){ $content.='<div id="xyz_'.$works->id.'"> <div class="col-md-3" style="padding-top: 10px;"> <select id="products" name="cutting_products[]" class="form-control tip" style="width:100%;"> <option value="'.$works->product_id.'">'.$works->product_name.'</option> </select> </div>'; $content.='<input type="hidden" name="cutting_products_name[]" value="'.$works->product_name.'" class="form-control tip" style="width:100%;"> <input type="hidden" name="cutting_update_works_id[]" value="'.$works->id.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3" style="padding-top: 10px;"> <select id="user_name_'.$works->id.'" name="cutting_user_name[]" class="form-control tip" style="width:100%;"> '.$user_content.' </select> </div>'; $content.='<div class="col-md-2" style="padding-top: 10px;"> <input type="number" id="qty_'.$d->product_id.'" name="cutting_quantity[]" value="'.$works->quantity.'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip qqty_'.$d->product_id.' quantity" style="width:100%;" /> </div>'; $content.='<input type="hidden" id="bal_'.$d->product_id.'" value="" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="total" name="cutting_total_quantity[]" value="'.number_format("$works->quantity").'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" />'; /*<input type="hidden" id="tot_'.$d->product_id.'" value="'.$works->total_qty.'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" />*/ $content.='<div class="col-md-3" style="padding-top: 10px;"> <input type="date" id="date_'.$works->id.'" value="'.$works->cutting_assign_date.'" name="cutting_assign_date[]" style="padding: 8px;" class="form-control tip today_date"> </div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 10px 0px 0px 5px;">'; if($works->quantity>1){ $content.='<a onClick="deleteAssignedID('.$works->id.','.$d->product_id.')" class="tip btn btn-danger btn-xs" style="padding: 5px 10px 5px 10px;"><i class="fa fa-trash-o"></i></a>'; //$content.='<span id="expand_sale_items_'.$works->id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; }else{ } $content.='<input type="hidden" id="work_sale_id" value="'.$works->sale_id.'" name="work_sale_id[]" class="form-control work_sale_id" style="width:100%;"> <input type="hidden" id="work_product_id" value="'.$works->product_id.'" name="work_product_id[]" class="form-control work_product_id" style="width:100%;">'; $content.='</div>'; $content.='</div>'; $content.=''; } } // New One Ends Here $content.='<div class="col-md-4" style="padding-top: 6px;padding-left: 50px;"> <b>Total Quantity: <span id="total_qty_'.$d->product_id.'"><input type="hidden" id="total_product_quantity_'.$d->product_id.'" value="'.number_format("$d->quantity").'" hidden>'.number_format("$d->quantity").'</span></b> </div> <div class="col-md-4" style="padding-top: 6px;padding-left: 50px;"> </div> <div class="col-md-3" style="padding-top: 6px;padding-left: 50px;"> <b id="bal_total_qty_'.$d->id.'">Remaining Quantity: <span id="balance_qty_'.$d->product_id.'">'.$d->remaing_cutting_qty.'</span></b> </div> <div class="col-md-1" style="padding-top: 6px;">'; $content.='<span id="expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; $content.='</div>'; $content.='<div id="expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div>'; $content.='</div>'; $content.='<script> $("#expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-3"><select id="products" name="works_cutting_products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option> </select><input type="hidden" name="works_cutting_products_name[]" value="'.$works->product_name.'" class="form-control tip" style="width:100%;"></div><div class="col-md-3"><input name="new_status[]" type="hidden" value="0"><select id="user_name_'.$works->id.'" name="works_cutting_username[]" class="form-control tip" style="width:100%;">'.$new_user_content.'</select></div><div class="col-md-2"><input type="number" name="works_cutting_quantity[]" id="qty_'.$works->id.'" value="" class="form-control tip qqty_'.$d->product_id.' quantity" style="width:100%;" /><input type="hidden" id="total" name="works_cutting_total_quantity[]" value="'.number_format("$works->quantity").'" min="1" class="form-control tip" style="width:100%;" /></div><div class="col-md-3"><input type="date" id="date_'.$d->id.'" value="" name="works_cutting_assign_date[]" style="padding: 8px;" class="form-control tip today_date"></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="expand_remove_'.$works->product_id.'" class="btn btn-danger btn-xs expand_remove_'.$works->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#expand_conteent_'.$d->product_id.'").append(html); }); </script>'; $content.='<script> $(function() { $(document).on("click", ".expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".qqty_'.$d->product_id.'",function(){ var quantity=Number($(this).val()); console.log("ASSIGNED QUANTITY"+quantity); grand_total(); }); function grand_total(){ var tot=0; $(".qqty_'.$d->product_id.'").each(function(){ tot+=Number($(this).val()); /*var total = $("#tot_'.$works->product_id.'").val();*/ /*total_product_quantity_'.$works->product_id.'*/ var total = $("#total_product_quantity_'.$d->product_id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; console.log(grand_balance); $("#balance_qty_'.$d->product_id.'").text(grand_balance); $("#qtty_'.$d->product_id.'").val(grand_balance); if($("#balance_qty_'.$d->product_id.'").text() < 0){ $("#bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#cutting_update").prop("disabled", true); }else{ $("#bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#cutting_update").prop("disabled", false); } }); } }); function grand_totals(){ var tot=0; console.log("Ganesan #total_product_quantity_'.$d->product_id.'"); $(".qqty_'.$d->product_id.'").each(function(){ tot+=Number($(this).val()); /*var total = $("#tot_'.$works->product_id.'").val();*/ /*total_product_quantity_'.$works->product_id.'*/ var total = $("#total_product_quantity_'.$d->product_id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; console.log(grand_balance); $("#balance_qty_'.$d->product_id.'").text(grand_balance); $("#qtty_'.$d->product_id.'").val(grand_balance); if($("#balance_qty_'.$d->product_id.'").text() < 0){ $("#bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#cutting_update").prop("disabled", true); }else{ $("#bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#cutting_update").prop("disabled", false); } }); var total = $("#total_product_quantity_'.$d->product_id.'").val(); console.log("loop:"+total); console.log("Total Gane:"+total); grand_balance=total-tot; console.log(grand_balance); $("#balance_qty_'.$d->product_id.'").text(grand_balance); $("#qtty_'.$d->product_id.'").val(grand_balance); if($("#balance_qty_'.$d->product_id.'").text() < 0){ $("#bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#cutting_update").prop("disabled", true); }else{ $("#bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#cutting_update").prop("disabled", false); } } </script>'; } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="cutting_update" class="btn btn-success" value="Update"></div>'; } /********* Cutting Status Partial Endss ************/ }else{ $content.='<center><h6>Cutting Status Fully Assign Working</h6></center>'; } } } /*$content.= $button;*/ else{ $content.='No Data Available'; } echo $content; } // *********************** Latest NEWWWWWWWWWWWWW Cutting Status Endss Here **************************************** // // *********************** Latest NEWWWWWWWWWWWWWWWWW Stitching Status Starts Here ****************************************// public function get_all_sale_stitching_items() { $sales_id = $this->input->get('sale_id'); $date = $this->input->get('date'); $mainsale_datas=$this->sales_model->getSaleMainTable($sales_id); $data=$this->sales_model->getSaleIemsBySaleID($sales_id); $work_units=$this->sales_model->getSaleWorkUnitsTable($sales_id); $sale_works_data=$this->sales_model->getSaleIemsBySaleIDWithWorksTable($sales_id); $user_data = $this->sales_model->getAllStaff(); $content='<div class="row"> <div class="col-md-3"> <label for="products">Products</label> </div> <div class="col-md-3"> <label for="products">Users</label> </div> <div class="col-md-2"> <label for="products">Qty</label> </div> <div class="col-md-3"> <label for="products">Assign Date</label> </div> <div class="col-md-1"> <label for="products">Actions</label> </div> </div>'; if($mainsale_datas){ foreach($mainsale_datas as $salemain){ if($salemain->stitching_status==1){ /********* Cutting Status Starts ************/ $content.='<center><h6>NEWW Stitching Status Not Assign Working</h6></center>'; if($data){ $content.='<input type="hidden" value="'.$sales_id.'" id="cutting_sale_ids" name="cutting_sale_id" /> <input type="hidden" value="4" id="cutting_status" name="cutting_status" />'; foreach($data as $d){ if($d->product_type=="service" && $d->stitching_status=="1"){ $user_content='<option value="0">Select User</option>'; if($user_data){ foreach($user_data as $user){ $user_content.='<option value="'.$user->id.'" '.(($d->cutting_user_id==$user->id)?'selected="selected"':"").'>'.$user->first_name. "" . $user->last_name.'</option>'; } }else{ $user_content.='<option value="">No Data Available</option>'; } $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-3"> <select id="products" name="cutting_products[]" class="form-control tip" style="width:100%;"> <option value="'.$d->product_id.'">'.$d->product_name.'</option> </select> </div>'; $content.='<input type="hidden" name="cutting_not_assign_products[]" value="'.$d->product_id.'" /> <input type="hidden" name="cutting_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"> <input type="hidden" name="cutting_not_assign_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3"> <select id="user_name_'.$d->id.'" name="cutting_user_name[]" class="form-control tip" style="width:100%;"> '.$user_content.' </select> </div>'; $content.='<div class="col-md-2"> <input type="number" id="s_qty_'.$d->id.'" name="cutting_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip s_qqty_'.$d->id.' quantity" style="width:100%;" /> </div>'; $content.='<input type="hidden" id="s_qtty_'.$d->id.'" value="" max="'.number_format("$d->quantity").'" class="form-control" style="width:100%;" /> <input type="hidden" id="s_tot_'.$d->id.'" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="s_total" name="cutting_total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" name="cutting_not_assign_total_qty[]" value="'.number_format("$d->quantity").'">'; $content.='<div class="col-md-3"> <input type="date" id="date_'.$d->id.'" value="'.$d->cutting_assign_date.'" name="cutting_assign_date[]" style="padding: 8px;" class="form-control tip today_date"> </div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; if(number_format("$d->quantity")==1){ }else{ $content.='<span id="s_expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; } $content.='<input type="hidden" id="work_sale_id" value="'.$d->sale_id.'" name="work_sale_id[]" class="form-control work_sale_id" style="width:100%;"> <input type="hidden" id="work_product_id" value="'.$d->product_id.'" name="work_product_id[]" class="form-control work_product_id" style="width:100%;">'; $content.='</div>'; $content.='<div id="s_expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div>'; $content.='<div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="s_total_qty_'.$d->product_id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="s_bal_total_qty_'.$d->product_id.'">Remaining Quantity: <span id="s_balance_qty_'.$d->product_id.'">0</span></b> </div> </div>'; $content.='</div>'; $content.='<script> $("#s_expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-3"><select id="products" name="cutting_products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option> </select><input type="hidden" name="cutting_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"></div><div class="col-md-3"><select id="user_name_'.$d->id.'" name="cutting_user_name[]" class="form-control tip" style="width:100%;">'.$user_content.'</select></div><div class="col-md-2"><input type="number" name="cutting_quantity[]" id="qty_'.$d->id.'" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip s_qqty_'.$d->id.' quantity" style="width:100%;" required /><input type="hidden" id="total" name="cutting_total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /></div><div class="col-md-3"><input type="date" id="date_'.$d->id.'" value="'.$d->cutting_assign_date.'" name="cutting_assign_date[]" style="padding: 8px;" class="form-control tip today_date"></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="expand_remove_'.$d->product_id.'" class="btn btn-danger btn-xs expand_remove_'.$d->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#s_expand_conteent_'.$d->product_id.'").append(html); }); </script>'; $content.='<script> $(document).ready(function(){ $("#s_total_qty_'.$d->product_id.'").text('.number_format("$d->quantity").'); }); $(function() { $(document).on("click", ".expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".s_qqty_'.$d->id.'",function(){ var quantity=Number($(this).val()); grand_total(); }); function grand_total(){ var tot=0; $(".s_qqty_'.$d->id.'").each(function(){ tot+=Number($(this).val()); var total = $("#s_tot_'.$d->id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; $("#s_balance_qty_'.$d->product_id.'").text(grand_balance); $("#s_baal_total_qty_'.$d->product_id.'").val(grand_balance); $("#s_qtty_'.$d->id.'").val(grand_balance); if($("#s_balance_qty_'.$d->product_id.'").text() < 0){ $("#s_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#s_cutting_submit").prop("disabled", true); }else{ $("#bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#s_cutting_submit").prop("disabled", false); } }); } }); </script><style> .redBackground { background-color: red; } </style>'; } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="s_cutting_submit" class="btn btn-success" value="Submit"></div>'; } /********* Cutting Status Endss ************/ }else if($salemain->stitching_status==2){ /********* Cutting Status Partial Starts ************/ $content.='<center><h6>Stitching Status Partial Assign Working</h6></center>'; if($work_units){ $content.='<input type="hidden" value="'.$sales_id.'" id="cutting_sale_ids" name="cutting_sale_id" /> <input type="hidden" value="44" id="cutting_status" name="cutting_status" />'; foreach($data as $d){ if($d->product_type=="service" && $d->stitching_status=="0"){ $content.='<div class="row" style="padding: 15px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-3" style="text-align: left;"> <span class="label label-warning" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Product Name: '.$d->product_name.'<span> </div>'; $content.='<div class="col-md-3" style="text-align: center;"> <span class="label label-info btn-sm" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Total Quantity: '.number_format("$d->quantity").'</span> </div>'; /*<span class="label label-success btn-sm" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Assigned Quantity: '.$d->cutting_assigned.'</span> <span class="label label-danger btn-sm" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Balance Quantity: '.$d->remaing_cutting_qty.'</span>*/ $content.='<div class="col-md-3" style="text-align: center;"> </div>'; $content.='<div class="col-md-3" style="text-align: center;"> </div>'; // New One Starts Here foreach($work_units as $works){ $user_content='<option value="0">Select User</option>'; $new_user_content='<option value="0">Select User</option>'; if($user_data){ foreach($user_data as $user){ $user_content.='<option value="'.$user->id.'" '.(($works->stitching_user_id==$user->id)?'selected="selected"':"").'>'.$user->first_name. "" . $user->last_name.'</option>'; $new_user_content.='<option value="'.$user->id.'">'.$user->first_name. "" . $user->last_name.'</option>'; } }else{ $user_content.='<option value="">No Data Available</option>'; $new_user_content.='<option value="">No Data Available</option>'; } if($works->type=="2" && $works->product_id==$d->product_id){ $content.='<div id="xyz_'.$works->id.'"> <div class="col-md-3" style="padding-top: 10px;"> <select id="products" name="cutting_products[]" class="form-control tip" style="width:100%;"> <option value="'.$works->product_id.'">'.$works->product_name.'</option> </select> </div>'; $content.='<input type="hidden" name="cutting_products_name[]" value="'.$works->product_name.'" class="form-control tip" style="width:100%;"> <input type="hidden" name="cutting_update_works_id[]" value="'.$works->id.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3" style="padding-top: 10px;"> <select id="user_name_'.$works->id.'" name="cutting_user_name[]" class="form-control tip" style="width:100%;"> '.$user_content.' </select> </div>'; $content.='<div class="col-md-2" style="padding-top: 10px;"> <input type="number" id="s_qty_'.$d->product_id.'" name="cutting_quantity[]" value="'.$works->quantity.'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip s_qqty_'.$d->product_id.' quantity" style="width:100%;" /> </div>'; $content.='<input type="hidden" id="s_bal_'.$d->product_id.'" value="" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="s_total" name="cutting_total_quantity[]" value="'.number_format("$works->quantity").'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" />'; /*<input type="hidden" id="tot_'.$d->product_id.'" value="'.$works->total_qty.'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" />*/ $content.='<div class="col-md-3" style="padding-top: 10px;"> <input type="date" id="date_'.$works->id.'" value="'.$works->stitching_assign_date.'" name="cutting_assign_date[]" style="padding: 8px;" class="form-control tip today_date"> </div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 10px 0px 0px 5px;">'; if($works->quantity>1){ $content.='<a onClick="deleteAssignedID('.$works->id.','.$d->product_id.')" class="tip btn btn-danger btn-xs" style="padding: 5px 10px 5px 10px;"><i class="fa fa-trash-o"></i></a>'; //$content.='<span id="expand_sale_items_'.$works->id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; }else{ } $content.='<input type="hidden" id="work_sale_id" value="'.$works->sale_id.'" name="work_sale_id[]" class="form-control work_sale_id" style="width:100%;"> <input type="hidden" id="work_product_id" value="'.$works->product_id.'" name="work_product_id[]" class="form-control work_product_id" style="width:100%;">'; $content.='</div>'; $content.='</div>'; $content.=''; } } // New One Ends Here $content.='<div class="col-md-4" style="padding-top: 6px;padding-left: 50px;"> <b>Total Quantity: <span id="s_total_qty_'.$d->product_id.'"><input type="hidden" id="s_total_product_quantity_'.$d->product_id.'" value="'.number_format("$d->quantity").'" hidden>'.number_format("$d->quantity").'</span></b> </div> <div class="col-md-4" style="padding-top: 6px;padding-left: 50px;"> </div> <div class="col-md-3" style="padding-top: 6px;padding-left: 50px;"> <b id="s_bal_total_qty_'.$d->id.'">Remaining Quantity: <span id="s_balance_qty_'.$d->product_id.'">'.$d->remaing_cutting_qty.'</span></b> </div> <div class="col-md-1" style="padding-top: 6px;">'; $content.='<span id="s_expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; $content.='</div>'; $content.='<div id="s_expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div>'; $content.='</div>'; $content.='<script> $("#s_expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-3"><select id="products" name="works_cutting_products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option> </select><input type="hidden" name="works_cutting_products_name[]" value="'.$works->product_name.'" class="form-control tip" style="width:100%;"></div><div class="col-md-3"><input name="new_status[]" type="hidden" value="0"><select id="user_name_'.$works->id.'" name="works_cutting_username[]" class="form-control tip" style="width:100%;">'.$new_user_content.'</select></div><div class="col-md-2"><input type="number" name="works_cutting_quantity[]" id="qty_'.$works->id.'" value="" class="form-control tip s_qqty_'.$d->product_id.' quantity" style="width:100%;" /><input type="hidden" id="total" name="works_cutting_total_quantity[]" value="'.number_format("$works->quantity").'" min="1" class="form-control tip" style="width:100%;" /></div><div class="col-md-3"><input type="date" id="date_'.$d->id.'" value="" name="works_cutting_assign_date[]" style="padding: 8px;" class="form-control tip today_date"></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="s_expand_remove_'.$works->product_id.'" class="btn btn-danger btn-xs expand_remove_'.$works->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#s_expand_conteent_'.$d->product_id.'").append(html); }); </script>'; $content.='<script> $(function() { $(document).on("click", ".s_expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".s_qqty_'.$d->product_id.'",function(){ var quantity=Number($(this).val()); console.log("ASSIGNED QUANTITY"+quantity); grand_total(); }); function grand_total(){ var tot=0; $(".s_qqty_'.$d->product_id.'").each(function(){ tot+=Number($(this).val()); var total = $("#s_total_product_quantity_'.$d->product_id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; console.log(grand_balance); $("#s_balance_qty_'.$d->product_id.'").text(grand_balance); $("#s_qtty_'.$d->product_id.'").val(grand_balance); if($("#s_balance_qty_'.$d->product_id.'").text() < 0){ $("#s_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#s_cutting_update").prop("disabled", true); }else{ $("#s_bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#s_cutting_update").prop("disabled", false); } }); } }); function grand_totals(){ var tot=0; console.log("Ganesan #total_product_quantity_'.$d->product_id.'"); $(".s_qqty_'.$d->product_id.'").each(function(){ tot+=Number($(this).val()); var total = $("#s_total_product_quantity_'.$d->product_id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; console.log(grand_balance); $("#s_balance_qty_'.$d->product_id.'").text(grand_balance); $("#s_qtty_'.$d->product_id.'").val(grand_balance); if($("#s_balance_qty_'.$d->product_id.'").text() < 0){ $("#s_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#s_cutting_update").prop("disabled", true); }else{ $("#s_bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#s_cutting_update").prop("disabled", false); } }); var total = $("#s_total_product_quantity_'.$d->product_id.'").val(); console.log("loop:"+total); console.log("Total Gane:"+total); grand_balance=total-tot; console.log(grand_balance); $("#s_balance_qty_'.$d->product_id.'").text(grand_balance); $("#s_qtty_'.$d->product_id.'").val(grand_balance); if($("#s_balance_qty_'.$d->product_id.'").text() < 0){ $("#s_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#s_cutting_update").prop("disabled", true); }else{ $("#s_bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#s_cutting_update").prop("disabled", false); } } </script>'; } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="cutting_update" class="btn btn-success" value="Update"></div>'; } /********* Cutting Status Partial Endss ************/ }else{ $content.='<center><h6>Cutting Status Fully Assign Working</h6></center>'; } } } /*$content.= $button;*/ else{ $content.='No Data Available'; } echo $content; } // *********************** Latest NEWWWWWWWWWWWWW Stitching Status Endss Here **************************************** // // *********************** Latest STitching New Status Starts Here ****************************************// public function get_all_sale_stitching_itemss() { $sales_id = $this->input->get('sale_id'); $date = $this->input->get('date'); $mainsale_datas=$this->sales_model->getSaleMainTable($sales_id); $data=$this->sales_model->getSaleIemsBySaleID($sales_id); $work_units=$this->sales_model->getSaleWorkUnitsTable($sales_id); $sale_works_data=$this->sales_model->getSaleIemsBySaleIDWithWorksTable($sales_id); $user_data = $this->sales_model->getAllStaff(); $content='<div class="row"> <div class="col-md-3"> <label for="products">Products</label> </div> <div class="col-md-3"> <label for="products">Users</label> </div> <div class="col-md-2"> <label for="products">Qty</label> </div> <div class="col-md-3"> <label for="products">Assign Date</label> </div> <div class="col-md-1"> <label for="products">Actions</label> </div> </div>'; if($mainsale_datas){ foreach($mainsale_datas as $salemain){ if($salemain->stitching_status==1){ /********* Stitching Status Starts ************/ $content.='<center><h6>Stitching Status Not Assign Working</h6></center>'; if($data){ $content.='<input type="hidden" value="'.$sales_id.'" id="stitching_sale_id" name="stitching_sale_id" /> <input type="hidden" value="4" id="measurement_status_insert" name="measurement_status_insert" />'; foreach($data as $d){ if($d->product_type=="service" && $d->stitching_status=="1"){ $user_content='<option value="0">Select User</option>'; if($user_data){ foreach($user_data as $user){ $user_content.='<option value="'.$user->id.'" '.(($d->stitching_user_id==$user->id)?'selected="selected"':"").'>'.$user->first_name. "" . $user->last_name.'</option>'; } }else{ $user_content.='<option value="">No Data Available</option>'; } $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-3">'; $content.='<select id="products" name="stitching_products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$d->product_id.'">'.$d->product_name.'</option>'; $content.='</select>'; $content.='<input type="hidden" name="stitching_not_assign_products[]" value="'.$d->product_id.'" />'; $content.='<input type="hidden" name="stitching_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"> <input type="hidden" name="stitching_not_assign_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='</div>'; $content.='<div class="col-md-3">'; $content.='<select id="user_name_'.$d->id.'" name="stitching_user_name[]" class="form-control tip" style="width:100%;">'; $content.=''.$user_content.''; $content.='</select>'; $content.='</div>'; $content.='<div class="col-md-2">'; $content.='<input type="number" id="s_qty_'.$d->id.'" name="stitching_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip s_qqty_'.$d->id.' quantity" style="width:100%;" /> <input type="hidden" id="s_qtty_'.$d->id.'" value="" max="'.number_format("$d->quantity").'" class="form-control" style="width:100%;" /> <input type="hidden" id="s_tot_'.$d->id.'" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="s_total" name="stitching_total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" name="stitching_not_assign_total_qty[]" value="'.number_format("$d->quantity").'">'; $content.='</div>'; $content.='<div class="col-md-3">'; $content.='<input type="date" id="s_date_'.$d->id.'" value="'.$d->stitching_assign_date.'" name="stitching_assign_date[]" style="padding: 8px;" class="form-control tip today_date">'; $content.='</div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; if(number_format("$d->quantity")==1){ }else{ $content.='<span id="s_expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs s_expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; } $content.='<input type="hidden" id="work_sale_id" value="'.$d->sale_id.'" name="work_sale_id[]" class="form-control work_sale_id" style="width:100%;">'; $content.='<input type="hidden" id="work_product_id" value="'.$d->product_id.'" name="work_product_id[]" class="form-control work_product_id" style="width:100%;">'; $content.='</div>'; $content.='<div id="s_expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div> <div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="s_total_qty_'.$d->product_id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="bal_total_qty_'.$d->product_id.'">Remaining Quantity: <span id="s_balance_qty_'.$d->product_id.'">0</span></b> <input type="hidden" name="not_assign_stitching_quantity[]" id="s_baal_total_qty_'.$d->product_id.'"> </div> </div>'; $content.='</div>'; $content.='<script> $("#s_expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-3"><select id="products" name="stitching_products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option> </select><input type="hidden" name="stitching_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"></div><div class="col-md-3"><select id="user_name_'.$d->id.'" name="stitching_user_name[]" class="form-control tip" style="width:100%;">'.$user_content.'</select></div><div class="col-md-2"><input type="number" name="stitching_quantity[]" id="qty_'.$d->id.'" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip s_qqty_'.$d->id.' quantity" style="width:100%;" required /><input type="hidden" id="total" name="stitching_total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /></div><div class="col-md-3"><input type="date" id="date_'.$d->id.'" value="'.$d->stitching_assign_date.'" name="stitching_assign_date[]" style="padding: 8px;" class="form-control tip today_date"></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="s_expand_remove_'.$d->product_id.'" class="btn btn-danger btn-xs s_expand_remove_'.$d->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#s_expand_conteent_'.$d->product_id.'").append(html); }); </script>'; $content.='<script> $(document).ready(function(){ $("#s_total_qty_'.$d->product_id.'").text('.number_format("$d->quantity").'); }); $(function() { $(document).on("click", ".s_expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".s_qqty_'.$d->id.'",function(){ var quantity=Number($(this).val()); grand_total(); }); function grand_total(){ var tot=0; $(".s_qqty_'.$d->id.'").each(function(){ tot+=Number($(this).val()); var total = $("#s_tot_'.$d->id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; $("#s_balance_qty_'.$d->product_id.'").text(grand_balance); $("#s_baal_total_qty_'.$d->product_id.'").val(grand_balance); $("#s_qtty_'.$d->id.'").val(grand_balance); if($("#s_balance_qty_'.$d->product_id.'").text() < 0){ $("#s_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#stitching_submit").prop("disabled", true); }else{ $("#s_bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#stitching_submit").prop("disabled", false); } }); } }); </script><style> .redBackground { background-color: red; } </style>'; } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="stitching_submit" class="btn btn-success" value="Submit"></div>'; } /********* Stitching Status Endss ************/ }else if($salemain->stitching_status==2){ /********* Stitching Status Partial Starts ************/ $content.='<center><h6>Cutting Status Partial Assign Working</h6></center>'; if($data){ $content.='<input type="hidden" value="'.$sales_id.'" id="stitching_sale_id" name="stitching_sale_id" /> <input type="hidden" value="44" id="measurement_status_update" name="measurement_status_update" />'; foreach($work_units as $works){ if($works->type=="2"){ $user_content='<option value="0">Select User</option>'; $new_user_content='<option value="0">Select User</option>'; if($user_data){ foreach($user_data as $user){ $user_content.='<option value="'.$user->id.'" '.(($works->stitching_user_id==$user->id)?'selected="selected"':"").'>'.$user->first_name. "" . $user->last_name.'</option>'; $new_user_content.='<option value="'.$user->id.'">'.$user->first_name. "" . $user->last_name.'</option>'; } }else{ $user_content.='<option value="">No Data Available</option>'; $new_user_content.='<option value="">No Data Available</option>'; } $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-3">'; $content.='<select id="products" name="stitching_products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$works->product_id.'">'.$works->product_name.'</option>'; $content.='</select>'; $content.='</div>'; $content.='<input type="hidden" name="stitching_products_name[]" value="'.$works->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<input type="hidden" name="stitching_update_works_id[]" value="'.$works->id.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3">'; $content.='<select id="user_name_'.$works->id.'" name="stitching_user_name[]" class="form-control tip" style="width:100%;">'; $content.=''.$user_content.''; $content.='</select>'; $content.='</div>'; $content.='<div class="col-md-2">'; $content.='<input type="number" id="s_qty_'.$works->id.'" name="stitching_quantity[]" value="'.number_format("$works->quantity").'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip s_qqty_'.$works->id.' quantity" style="width:100%;" /> <input type="hidden" id="s_qtty_'.$works->id.'" name="not_assign_stitching_quantity[]" value="" max="'.number_format("$works->quantity").'" class="form-control" style="width:100%;" /> <input type="hidden" id="s_bal_'.$works->id.'" value="" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="s_tot_'.$works->id.'" value="'.number_format("$works->quantity").'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="s_total" name="stitching_total_quantity[]" value="'.number_format("$works->quantity").'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" />'; $content.='</div>'; $content.='<div class="col-md-3">'; $content.='<input type="date" id="date_'.$works->id.'" value="'.$works->stitching_assign_date.'" name="stitching_assign_date[]" style="padding: 8px;" class="form-control tip today_date">'; $content.='</div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; if(number_format("$works->quantity")==1){ }else{ $content.='<span id="s_expand_sale_items_'.$works->id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; } $content.='<input type="hidden" id="s_work_sale_id" value="'.$works->sale_id.'" name="work_sale_id[]" class="form-control work_sale_id" style="width:100%;">'; $content.='<input type="hidden" id="s_work_product_id" value="'.$works->product_id.'" name="work_product_id[]" class="form-control work_product_id" style="width:100%;">'; $content.='</div>'; $content.='<div id="s_expand_conteent_'.$works->id.'" style="padding: 0px 0px 0px 0px;"></div> <div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="s_total_qty_'.$works->id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="s_bal_total_qty_'.$works->id.'">Remaining Quantity: <span id="s_balance_qty_'.$works->id.'">0</span></b> </div> </div>'; $content.='</div>'; $content.='<script> $("#s_expand_sale_items_'.$works->id.'").on("click", function() { html=`<div class="rows"><div class="col-md-3"><select id="products" name="works_stitching_products[]" class="form-control tip" style="width:100%;"><option value="'.$works->product_id.'">'.$works->product_name.'</option> </select><input type="hidden" name="works_stitching_products_name[]" value="'.$works->product_name.'" class="form-control tip" style="width:100%;"></div><div class="col-md-3"><input name="new_status[]" type="hidden" value="0"><select id="user_name_'.$works->id.'" name="works_stitching_username[]" class="form-control tip" style="width:100%;">'.$new_user_content.'</select></div><div class="col-md-2"><input type="number" name="works_stitching_quantity[]" required id="s_qty_'.$works->id.'" value="" min="1" max="'.number_format("$works->quantity").'" class="form-control tip s_qqty_'.$works->id.' quantity" style="width:100%;" /><input type="hidden" id="total" name="works_stitching_total_quantity[]" value="'.number_format("$works->quantity").'" min="1" class="form-control tip" style="width:100%;" /></div><div class="col-md-3"><input type="date" id="date_'.$d->id.'" value="" name="works_stitching_assign_date[]" style="padding: 8px;" class="form-control tip today_date"></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="s_expand_remove_'.$works->product_id.'" class="btn btn-danger btn-xs s_expand_remove_'.$works->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#s_expand_conteent_'.$works->id.'").append(html); }); </script>'; $content.='<script> $(document).ready(function(){ $("#s_total_qty_'.$works->id.'").text('.number_format("$works->quantity").'); }); $(function() { $(document).on("click", ".s_expand_remove_'.$works->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".s_qqty_'.$works->id.'",function(){ var quantity=Number($(this).val()); grand_total(); }); function grand_total(){ var tot=0; $(".s_qqty_'.$works->id.'").each(function(){ tot+=Number($(this).val()); var total = $("#s_tot_'.$works->id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; console.log(grand_balance); $("#s_balance_qty_'.$works->id.'").text(grand_balance); $("#s_qtty_'.$works->id.'").val(grand_balance); if($("#s_balance_qty_'.$works->id.'").text() < 0){ $("#s_bal_total_qty_'.$works->id.'").css({"color":"#FF0000"}); $("#stitching_update").prop("disabled", true); }else{ $("#s_bal_total_qty_'.$works->id.'").css({"color":"black"}); $("#stitching_update").prop("disabled", false); } }); } });</script>'; } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="stitching_update" class="btn btn-success" value="Update"></div>'; } /********* Cutting Status Partial Endss ************/ }else{ $content.='<center><h6>Stitching Status Fully Assign Working</h6></center>'; } } } else{ $content.='No Data Available'; } echo $content; } // *********************** Latest Stitchingg Status Endss Here **************************************** // // *********************** Latest NEWWWWW Ready Items Status Starts Here ****************************************// public function ready_items() { $sales_id = $this->input->get('sale_id'); $date = $this->input->get('date'); $mainsale_datas=$this->sales_model->getSaleMainTable($sales_id); $data=$this->sales_model->getSaleIemsBySaleID($sales_id); $work_units=$this->sales_model->getSaleWorkUnitsTable($sales_id); $sale_works_data=$this->sales_model->getSaleIemsBySaleIDWithWorksTable($sales_id); $user_data = $this->sales_model->getAllStaff(); $content='<div class="row"> <div class="col-md-4"> <label for="products">Products</label> </div> <div class="col-md-3"> <label for="products">Qty</label> </div> <div class="col-md-4"> <label for="products">Status</label> </div> <div class="col-md-1"> <label for="products">Actions</label> </div> </div>'; if($mainsale_datas){ foreach($mainsale_datas as $salemain){ if($salemain->ready_to_delivery_status==1){ /********* Cutting Status Starts ************/ $content.='<center><h6>NEWW Cutting Status Not Assign Working</h6></center>'; if($data){ $content.='<input type="hidden" value="'.$sales_id.'" id="ready_to_delivery_sale_ids" name="sale_id" /> <input type="hidden" value="6" id="measurement_status" name="measurement_status_insert" />'; foreach($data as $d){ if($d->product_type=="service" && $d->ready_products_status=="1"){ $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-4">'; $content.='<select id="products" name="products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$d->product_id.'">'.$d->product_name.'</option>'; $content.='</select>'; $content.='<input type="hidden" name="ready_products_not_assign_products[]" value="'.$d->product_id.'" /> <input type="hidden" name="ready_products_not_assign_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='</div>'; $content.='<input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3">'; $content.='<input type="number" id="r_qty_'.$d->id.'" name="quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" /> <input type="hidden" name="not_assign_quantity[]" id="r_not_assign_qty_'.$d->id.'" value="" max="'.number_format("$d->quantity").'" class="form-control" style="width:100%;" /> <input type="hidden" id="r_bal_'.$d->id.'" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="r_tot_'.$d->id.'" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="total" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" name="ready_products_not_assign_total_qty[]" value="'.number_format("$d->quantity").'">'; $content.='</div>'; $content.='<div class="col-md-4">'; $content.='<select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"> <option value="ready" '.(($d->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option> <option value="not_ready" '.(($d->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option> </select>'; $content.='</div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; $content.='<span id="r_expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; $content.='</div>'; $content.='<div id="r_expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div> <div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="r_total_qty_'.$d->product_id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="r_bal_total_qty_'.$d->product_id.'">Remaining Quantity: <span id="r_balance_qty_'.$d->product_id.'">0</span></b> </div> </div>'; $content.='</div>'; $button='<div style="float: right; padding-top: 30px;"><input type="submit" id="ready_to_delivery_submit" class="btn btn-success" value="Submit"></div>'; $content.='<script> $(document).ready(function(){ $("#r_total_qty_'.$d->product_id.'").text('.number_format("$d->quantity").'); }); $("#r_expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-4"><select id="products" name="products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option></select></div><input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"><div class="col-md-3"><input type="number" id="r_qty_'.$d->id.'" name="quantity[]" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" /><input type="hidden" id="total" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /></div><div class="col-md-4"><select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"><option value="ready" '.(($d->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option><option value="not_ready" '.(($d->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option></select></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="vexpand_remove_'.$d->product_id.'" class="btn btn-danger btn-xs s_expand_remove_'.$d->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#r_expand_conteent_'.$d->product_id.'").append(html); }); $(function() { $(document).on("click", ".r_expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".r_qqty_'.$d->id.'",function(){ var quantity=Number($(this).val()); grand_total(); }); function grand_total(){ var tot=0; $(".r_qqty_'.$d->id.'").each(function(){ tot+=Number($(this).val()); var total = $("#r_tot_'.$d->id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; $("#r_balance_qty_'.$d->product_id.'").text(grand_balance); $("#r_not_assign_qty_'.$d->id.'").val(grand_balance); if($("#r_balance_qty_'.$d->product_id.'").text() < 0){ $("#r_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#ready_to_delivery_submit").prop("disabled", true); }else{ $("#r_bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#ready_to_delivery_submit").prop("disabled", false); } }); } }); </script>'; } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="ready_to_delivery_submit" class="btn btn-success" value="Submit"></div>'; } /********* Cutting Status Endss ************/ }else if($salemain->ready_to_delivery_status==2){ /********* Cutting Status Partial Starts ************/ $content.='<center><h6>Cutting Status Partial Assign Working</h6></center>'; if($work_units){ $content.='<input type="hidden" value="'.$sales_id.'" id="ready_to_delivery_sale_ids" name="sale_id" /> <input type="hidden" value="66" id="measurement_status" name="measurement_status_update" />'; foreach($data as $d){ if($d->product_type=="service" && $d->ready_products_status=="0"){ // Ready Items Here $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-4">'; $content.='<select id="products" name="products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$d->product_id.'">'.$d->product_name.'</option>'; $content.='</select>'; $content.='<input type="hidden" name="ready_products_not_assign_products[]" value="'.$d->product_id.'" /> <input type="hidden" name="ready_products_not_assign_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='</div>'; $content.='<input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3">'; $content.='<input type="number" id="r_qty_'.$d->id.'" name="quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" /> <input type="hidden" name="not_assign_quantity[]" id="r_not_assign_qty_'.$d->id.'" value="" max="'.number_format("$d->quantity").'" class="form-control" style="width:100%;" /> <input type="hidden" id="r_bal_'.$d->id.'" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="r_tot_'.$d->id.'" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="total" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" name="ready_products_not_assign_total_qty[]" value="'.number_format("$d->quantity").'">'; $content.='</div>'; $content.='<div class="col-md-4">'; $content.='<select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"> <option value="ready" '.(($d->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option> <option value="not_ready" '.(($d->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option> </select>'; $content.='</div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; $content.='<span id="r_expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; $content.='</div>'; $content.='<div id="r_expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div> <div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="r_total_qty_'.$d->product_id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="r_bal_total_qty_'.$d->product_id.'">Remaining Quantity: <span id="r_balance_qty_'.$d->product_id.'">0</span></b> </div> </div>'; $content.='</div>'; $button='<div style="float: right; padding-top: 30px;"><input type="submit" id="ready_to_delivery_submit" class="btn btn-success" value="Submit"></div>'; $content.='<script> $(document).ready(function(){ $("#r_total_qty_'.$d->product_id.'").text('.number_format("$d->quantity").'); }); $("#r_expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-4"><select id="products" name="products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option></select></div><input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"><div class="col-md-3"><input type="number" id="r_qty_'.$d->id.'" name="quantity[]" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" /><input type="hidden" id="total" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /></div><div class="col-md-4"><select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"><option value="ready" '.(($d->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option><option value="not_ready" '.(($d->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option></select></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="vexpand_remove_'.$d->product_id.'" class="btn btn-danger btn-xs s_expand_remove_'.$d->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#r_expand_conteent_'.$d->product_id.'").append(html); }); $(function() { $(document).on("click", ".r_expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".r_qqty_'.$d->id.'",function(){ var quantity=Number($(this).val()); grand_total(); }); function grand_total(){ var tot=0; $(".r_qqty_'.$d->id.'").each(function(){ tot+=Number($(this).val()); var total = $("#r_tot_'.$d->id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; $("#r_balance_qty_'.$d->product_id.'").text(grand_balance); $("#r_not_assign_qty_'.$d->id.'").val(grand_balance); if($("#r_balance_qty_'.$d->product_id.'").text() < 0){ $("#r_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#ready_to_delivery_submit").prop("disabled", true); }else{ $("#r_bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#ready_to_delivery_submit").prop("disabled", false); } }); } }); </script>'; // Ready Items Here } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="cutting_update" class="btn btn-success" value="Update"></div>'; } /********* Cutting Status Partial Endss ************/ }else{ $content.='<center><h6>Cutting Status Fully Assign Working</h6></center>'; } } } /*$content.= $button;*/ else{ $content.='No Data Available'; } echo $content; } // *********************** Latest NEWWWWWW Ready Items Endss Here **************************************** // // *********************** Latest Ready to Delievry Startsss Here **************************************** // public function get_all_ready_itemsss() { $sales_id = $this->input->get('sale_id'); $date = $this->input->get('date'); $data=$this->sales_model->getSaleIemsBySaleID($sales_id); $work_units=$this->sales_model->getSaleWorkUnitsTable($sales_id); $user_data = $this->sales_model->getAllStaff(); $content='<div class="row"> <div class="col-md-4"> <label for="products">Products</label> </div> <div class="col-md-3"> <label for="products">Qty</label> </div> <div class="col-md-4"> <label for="products">Status</label> </div> <div class="col-md-1"> <label for="products">Actions</label> </div> </div>'; if($data){ $content.='<input type="hidden" value="'.$sales_id.'" id="ready_to_delivery_sale_ids" name="sale_id" /> <input type="hidden" value="6" id="measurement_status" name="measurement_status_insert" />'; foreach($data as $d){ if($d->product_type=="service" && $d->ready_products_status=="1"){ $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-4">'; $content.='<select id="products" name="products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$d->product_id.'">'.$d->product_name.'</option>'; $content.='</select>'; $content.='<input type="hidden" name="ready_products_not_assign_products[]" value="'.$d->product_id.'" /> <input type="hidden" name="ready_products_not_assign_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='</div>'; $content.='<input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3">'; $content.='<input type="number" id="r_qty_'.$d->id.'" name="quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" /> <input type="hidden" name="not_assign_quantity[]" id="r_not_assign_qty_'.$d->id.'" value="" max="'.number_format("$d->quantity").'" class="form-control" style="width:100%;" /> <input type="hidden" id="r_bal_'.$d->id.'" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="r_tot_'.$d->id.'" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="total" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" name="ready_products_not_assign_total_qty[]" value="'.number_format("$d->quantity").'">'; $content.='</div>'; $content.='<div class="col-md-4">'; $content.='<select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"> <option value="ready" '.(($d->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option> <option value="not_ready" '.(($d->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option> </select>'; $content.='</div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; $content.='<span id="r_expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; $content.='</div>'; $content.='<div id="r_expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div> <div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="r_total_qty_'.$d->product_id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="r_bal_total_qty_'.$d->product_id.'">Remaining Quantity: <span id="r_balance_qty_'.$d->product_id.'">0</span></b> </div> </div>'; $content.='</div>'; $button='<div style="float: right; padding-top: 30px;"><input type="submit" id="ready_to_delivery_submit" class="btn btn-success" value="Submit"></div>'; $content.='<script> $(document).ready(function(){ $("#r_total_qty_'.$d->product_id.'").text('.number_format("$d->quantity").'); }); $("#r_expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-4"><select id="products" name="products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option></select></div><input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"><div class="col-md-3"><input type="number" id="r_qty_'.$d->id.'" name="quantity[]" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" /><input type="hidden" id="total" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /></div><div class="col-md-4"><select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"><option value="ready" '.(($d->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option><option value="not_ready" '.(($d->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option></select></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="vexpand_remove_'.$d->product_id.'" class="btn btn-danger btn-xs s_expand_remove_'.$d->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#r_expand_conteent_'.$d->product_id.'").append(html); }); $(function() { $(document).on("click", ".r_expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".r_qqty_'.$d->id.'",function(){ var quantity=Number($(this).val()); grand_total(); }); function grand_total(){ var tot=0; $(".r_qqty_'.$d->id.'").each(function(){ tot+=Number($(this).val()); var total = $("#r_tot_'.$d->id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; $("#r_balance_qty_'.$d->product_id.'").text(grand_balance); $("#r_not_assign_qty_'.$d->id.'").val(grand_balance); if($("#r_balance_qty_'.$d->product_id.'").text() < 0){ $("#r_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#ready_to_delivery_submit").prop("disabled", true); }else{ $("#r_bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#ready_to_delivery_submit").prop("disabled", false); } }); } }); </script>'; } } if($work_units){ $content.='<input type="hidden" value="'.$sales_id.'" id="ready_to_delivery_sale_ids" name="sale_id" /> <input type="hidden" value="66" id="measurement_status" name="measurement_status_update" />'; foreach($work_units as $works){ if($works->type=="3"){ $user_content='<option value="0">Select User</option>'; if($user_data){ foreach($user_data as $user){ $user_content.='<option value="'.$user->id.'" '.(($works->stitching_user_id==$user->id)?'selected="selected"':"").'>'.$user->first_name. "" . $user->last_name.'</option>'; } }else{ $user_content.='<option value="">No Data Available</option>'; } $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #7ad1a1;">'; $content.='<div class="col-md-4">'; $content.='<select id="products" name="products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$works->product_id.'">'.$works->product_name.'</option>'; $content.='</select>'; $content.='</div>'; $content.='<input type="hidden" name="update_works_id[]" value="'.$works->id.'" class="form-control tip" style="width:100%;">'; $content.='<input type="hidden" name="products_name[]" value="'.$works->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3">'; $content.='<input type="number" id="r_qty_'.$works->id.'" name="quantity[]" value="'.number_format("$works->quantity").'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" />'; $content.='</div>'; $content.='<div class="col-md-4">'; $content.='<select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"> <option value="ready" '.(($works->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option> <option value="not_ready" '.(($works->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option> </select>'; $content.='</div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; $content.='<span> </span>'; $content.='</div>'; /*$content.='<div id="s_expand_conteent_'.$works->id.'" style="padding: 0px 0px 0px 0px;"></div> <div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="d_total_qty_'.$works->id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="d_bal_total_qty_'.$works->id.'">Remaining Quantity: <span id="d_balance_qty_'.$works->id.'">0</span></b> </div> </div>';*/ $content.='</div>'; $button='<div style="float: right; padding-top: 30px;"><input type="submit" id="ready_to_delivery_update" class="btn btn-info" value="Update"></div>'; } } } $content.= $button; }else{ $content.='No Data Available'; } echo $content; } // *********************** Latest Ready to Delievry Ends Here ******************************************* // // *********************** Latest NEWWWWWW Ready to Delievry Startsss Here **************************************** // public function get_all_ready_items() { $sales_id = $this->input->get('sale_id'); $date = $this->input->get('date'); $mainsale_datas=$this->sales_model->getSaleMainTable($sales_id); $data=$this->sales_model->getSaleIemsBySaleID($sales_id); $work_units=$this->sales_model->getSaleWorkUnitsTable($sales_id); $user_data = $this->sales_model->getAllStaff(); $content='<div class="row"> <div class="col-md-4"> <label for="products">Products</label> </div> <div class="col-md-3"> <label for="products">Qty</label> </div> <div class="col-md-4"> <label for="products">Status</label> </div> <div class="col-md-1"> <label for="products">Actions</label> </div> </div>'; if($mainsale_datas){ foreach($mainsale_datas as $salemain){ if($salemain->ready_to_delivery_status==1){ /********* Ready to Delievry Status Starts ************/ $content.='<center><h6>NEWW Ready to Delievry Status Not Assign Working</h6></center>'; if($data){ $content.='<input type="hidden" value="'.$sales_id.'" id="ready_to_delivery_sale_ids" name="sale_id" /> <input type="hidden" value="6" id="measurement_status" name="measurement_status_insert" />'; foreach($data as $d){ if($d->product_type=="service" && $d->ready_products_status=="1"){ $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-4">'; $content.='<select id="products" name="products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$d->product_id.'">'.$d->product_name.'</option>'; $content.='</select>'; $content.='<input type="hidden" name="ready_products_not_assign_products[]" value="'.$d->product_id.'" /> <input type="hidden" name="ready_products_not_assign_products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='</div>'; $content.='<input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3">'; $content.='<input type="number" id="r_qty_'.$d->id.'" name="quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" /> <input type="hidden" name="not_assign_quantity[]" id="r_not_assign_qty_'.$d->id.'" value="" max="'.number_format("$d->quantity").'" class="form-control" style="width:100%;" /> <input type="hidden" id="r_bal_'.$d->id.'" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="r_tot_'.$d->id.'" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" id="total" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /> <input type="hidden" name="ready_products_not_assign_total_qty[]" value="'.number_format("$d->quantity").'">'; $content.='</div>'; $content.='<div class="col-md-4">'; $content.='<select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"> <option value="ready" '.(($d->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option> <option value="not_ready" '.(($d->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option> </select>'; $content.='</div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; $content.='<span id="r_expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; $content.='</div>'; $content.='<div id="r_expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div> <div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="r_total_qty_'.$d->product_id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="r_bal_total_qty_'.$d->product_id.'">Remaining Quantity: <span id="r_balance_qty_'.$d->product_id.'">0</span></b> </div> </div>'; $content.='</div>'; $button='<div style="float: right; padding-top: 30px;"><input type="submit" id="ready_to_delivery_submit" class="btn btn-success" value="Submit"></div>'; $content.='<script> $(document).ready(function(){ $("#r_total_qty_'.$d->product_id.'").text('.number_format("$d->quantity").'); }); $("#r_expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-4"><select id="products" name="products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option></select></div><input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"><div class="col-md-3"><input type="number" id="r_qty_'.$d->id.'" name="quantity[]" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" /><input type="hidden" id="total" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /></div><div class="col-md-4"><select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"><option value="ready" '.(($d->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option><option value="not_ready" '.(($d->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option></select></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="vexpand_remove_'.$d->product_id.'" class="btn btn-danger btn-xs s_expand_remove_'.$d->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#r_expand_conteent_'.$d->product_id.'").append(html); }); $(function() { $(document).on("click", ".r_expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".r_qqty_'.$d->id.'",function(){ var quantity=Number($(this).val()); grand_total(); }); function grand_total(){ var tot=0; $(".r_qqty_'.$d->id.'").each(function(){ tot+=Number($(this).val()); var total = $("#r_tot_'.$d->id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; $("#r_balance_qty_'.$d->product_id.'").text(grand_balance); $("#r_not_assign_qty_'.$d->id.'").val(grand_balance); if($("#r_balance_qty_'.$d->product_id.'").text() < 0){ $("#r_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#ready_to_delivery_submit").prop("disabled", true); }else{ $("#r_bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#ready_to_delivery_submit").prop("disabled", false); } }); } }); </script>'; } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="cutting_submit" class="btn btn-success" value="Submit"></div>'; } /********* Cutting Status Endss ************/ }else if($salemain->ready_products_status==2){ /********* Cutting Status Partial Starts ************/ $content.='<center><h6>Ready to Delievry Status Partial Assign Working</h6></center>'; if($work_units){ $content.='<input type="hidden" value="'.$sales_id.'" id="cutting_sale_ids" name="cutting_sale_id" /> <input type="hidden" value="22" id="cutting_status" name="cutting_status" />'; foreach($data as $d){ if($d->product_type=="service"){ $content.='<div class="row" style="padding: 15px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-3" style="text-align: left;"> <span class="label label-warning" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Product Name: '.$d->product_name.'<span> </div>'; $content.='<div class="col-md-3" style="text-align: center;"> <span class="label label-info btn-sm" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Total Quantity: '.number_format("$d->quantity").'</span> </div>'; $content.='<div class="col-md-3" style="text-align: center;"> <span class="label label-success btn-sm" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Assigned Quantity: '.$d->cutting_assigned.'</span> </div>'; $content.='<div class="col-md-3" style="text-align: center;"> <span class="label label-danger btn-sm" style="padding: 5px 30px 5px 30px;font-size: 13px;text-align: center;">Balance Quantity: '.$d->remaing_cutting_qty.'</span> </div>'; // New One Starts Here foreach($work_units as $works){ if($works->type=="3" && $works->product_id==$d->product_id){ $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #7ad1a1;">'; $content.='<div class="col-md-4">'; $content.='<select id="products" name="products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$works->product_id.'">'.$works->product_name.'</option>'; $content.='</select>'; $content.='</div>'; $content.='<input type="hidden" name="update_works_id[]" value="'.$works->id.'" class="form-control tip" style="width:100%;">'; $content.='<input type="hidden" name="products_name[]" value="'.$works->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3">'; $content.='<input type="number" id="r_qty_'.$works->id.'" name="quantity[]" value="'.number_format("$works->quantity").'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip r_qqty_'.$d->id.' quantity" style="width:100%;" />'; $content.='</div>'; $content.='<div class="col-md-4">'; $content.='<select id="ready_not_ready" name="ready_not_ready[]" class="form-control tip" style="width:100%;"> <option value="ready" '.(($works->ready_or_not_ready=="ready")?'selected="selected"':"").'>Ready</option> <option value="not_ready" '.(($works->ready_or_not_ready=="not_ready")?'selected="selected"':"").'>Not Ready</option> </select>'; $content.='</div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; $content.='<span> </span>'; $content.='</div>'; /*$content.='<div id="s_expand_conteent_'.$works->id.'" style="padding: 0px 0px 0px 0px;"></div> <div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="d_total_qty_'.$works->id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="d_bal_total_qty_'.$works->id.'">Remaining Quantity: <span id="d_balance_qty_'.$works->id.'">0</span></b> </div> </div>';*/ $content.='</div>'; $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="ready_to_delivery_update" class="btn btn-info" value="Update"></div>'; } } // New One Ends Here } } $content.='<div style="float: right; padding-top: 30px;"><input type="submit" id="cutting_update" class="btn btn-success" value="Update"></div>'; } }else{ $content.='<center><h6>Ready to Delievry Status Fully Assign Working</h6></center>'; } } } else{ $content.='No Data Available'; } echo $content; } // *********************** Latest NEWWWWWWWW Ready to Delievry Ends Here ******************************************* // // ******************************************************************************************** // // Latest Delivery Date Startss Here // ******************************************************************************************** // public function get_all_delivery_items() { $sales_id = $this->input->get('sale_id'); $date = $this->input->get('date'); $data=$this->sales_model->getSaleIemsBySaleID($sales_id); $work_units=$this->sales_model->getSaleWorkUnitsTable($sales_id); $user_data = $this->sales_model->getAllStaff(); $content='<div class="row"> <div class="col-md-4"> <label for="products">Products</label> </div> <div class="col-md-3"> <label for="products">Qty</label> </div> <div class="col-md-4"> <label for="products">Delivery Date</label> </div> <div class="col-md-1"> <label for="products">Actions</label> </div> </div>'; if($data){ $content.='<input type="hidden" value="'.$sales_id.'" id="product_delivery_date" name="sale_id" /> <input type="hidden" value="8" id="measurement_status" name="measurement_status" />'; foreach($data as $d){ if($d->product_type=="service" && $d->delivery_date_status=="1"){ $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<div class="col-md-4">'; $content.='<select id="products" name="products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$d->product_id.'">'.$d->product_name.'</option>'; $content.='</select>'; $content.='</div>'; $content.='<input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;">'; $content.='<div class="col-md-3">'; $content.='<input type="number" id="d_qty_'.$d->id.'" name="quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip d_qqty_'.$d->id.' quantity" style="width:100%;" /> <input type="hidden" id="d_tot_'.$d->id.'" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" />'; $content.='</div>'; $content.='<div class="col-md-4"> <input type="date" id="d_qty_'.$d->id.'" name="delivery_date[]" value="" class="form-control tip" style="width:100%;" /> </div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; $content.='<span id="d_expand_sale_items_'.$d->product_id.'" class="btn btn-primary btn-xs expand_sale_items"><i class="fa fa-plus"></i> Add</span>'; $content.='</div>'; $content.='<div id="d_expand_conteent_'.$d->product_id.'" style="padding: 0px 0px 0px 0px;"></div> <div class="row"> <div class="col-md-6" style="padding-left: 50px;"> <b>Total Quantity: <span id="d_total_qty_'.$d->product_id.'"></span></b> </div> <div class="col-md-6" style="padding-left: 50px;"> <b id="d_bal_total_qty_'.$d->product_id.'">Remaining Quantity: <span id="d_balance_qty_'.$d->product_id.'">0</span></b> </div> </div>'; $content.='</div>'; $button='<div style="float: right; padding-top: 30px;"><input type="submit" id="delivery_partial_date_submit" class="btn btn-success" value="Submit"></div>'; $content.='<script> $(document).ready(function(){ $("#d_total_qty_'.$d->product_id.'").text('.number_format("$d->quantity").'); }); $("#d_expand_sale_items_'.$d->product_id.'").on("click", function() { html=`<div class="rows"><div class="col-md-4"><select id="products" name="products[]" class="form-control tip" style="width:100%;"><option value="'.$d->product_id.'">'.$d->product_name.'</option></select></div><input type="hidden" name="products_name[]" value="'.$d->product_name.'" class="form-control tip" style="width:100%;"><div class="col-md-3"><input type="number" id="d_qty_'.$d->id.'" name="quantity[]" value="" min="1" max="'.number_format("$d->quantity").'" class="form-control tip d_qqty_'.$d->id.' quantity" style="width:100%;" /><input type="hidden" id="total" name="total_quantity[]" value="'.number_format("$d->quantity").'" min="1" max="'.number_format("$d->quantity").'" class="form-control tip" style="width:100%;" /></div><div class="col-md-4"><input type="date" id="d_qty_'.$d->id.'" name="delivery_date[]" value="" class="form-control tip" style="width:100%;" /></div><div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;"><span id="d_expand_remove_'.$d->product_id.'" class="btn btn-danger btn-xs d_expand_remove_'.$d->product_id.'"><i class="fa fa-close"></i></span></div></div>`; $("#d_expand_conteent_'.$d->product_id.'").append(html); }); $(function() { $(document).on("click", ".d_expand_remove_'.$d->product_id.'", function() { $(this).closest(".rows").remove(); grand_total(); }); $("body").on("keyup",".d_qqty_'.$d->id.'",function(){ var quantity=Number($(this).val()); grand_total(); }); function grand_total(){ var tot=0; $(".d_qqty_'.$d->id.'").each(function(){ tot+=Number($(this).val()); var total = $("#d_tot_'.$d->id.'").val(); console.log("Total:"+tot); grand_balance=total-tot; $("#d_balance_qty_'.$d->product_id.'").text(grand_balance); if($("#d_balance_qty_'.$d->product_id.'").text() < 0){ $("#d_bal_total_qty_'.$d->product_id.'").css({"color":"#FF0000"}); $("#delivery_partial_date_submit").prop("disabled", true); }else{ $("#d_bal_total_qty_'.$d->product_id.'").css({"color":"black"}); $("#delivery_partial_date_submit").prop("disabled", false); } }); } }); </script>'; }} if($work_units){ foreach($work_units as $works){ if($works->type=="4"){ $content.='<div class="row" style="padding: 6px 0px 6px 0px; border: 1px dashed gray; border-radius: 5px; margin-top: 15px;background: #7ad1a1;">'; $content.='<div class="col-md-4">'; $content.='<select id="products" name="products[]" class="form-control tip" style="width:100%;">'; $content.='<option value="'.$works->product_id.'">'.$works->product_name.'</option>'; $content.='</select>'; $content.='</div>'; $content.='<div class="col-md-3">'; $content.='<input type="number" id="d_qty_'.$works->id.'" name="quantity[]" value="'.number_format("$works->quantity").'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip d_qqty_'.$d->id.' quantity" style="width:100%;" /> <input type="hidden" id="d_tot_'.$works->id.'" name="total_quantity[]" value="'.number_format("$works->quantity").'" min="1" max="'.number_format("$works->quantity").'" class="form-control tip" style="width:100%;" />'; $content.='</div>'; $content.='<div class="col-md-4"> <input type="date" id="d_qty_'.$works->id.'" name="delivery_date[]" value="'.$works->delivery_date.'" class="form-control tip" style="width:100%;" /> </div>'; $content.='<div class="col-md-1" style="text-align: center; padding: 5px 0px 0px 5px;">'; $content.='<span> </span>'; $content.='</div>'; $content.='</div>'; $button='<div style="float: right; padding-top: 30px;"><input type="submit" id="delivery_partial_date_update" class="btn btn-success" value="Update"></div>'; }} } $content.= $button; }else{ $content.='No Data Available'; } echo $content; } // ******************************************************************************************** // // Latest Delivery Date Ends Here // ******************************************************************************************** // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Histoty Starts Here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // public function get_all_unit_status_history() { $sales_id = $this->input->get('sale_id'); $data=$this->sales_model->getSaleWorkUnitsTable($sales_id); $user_data = $this->sales_model->getAllStaff(); if($data){ if(1==1){ $content.='<div class="row" style="padding: 0px 0px 0px 0px; border: 1px double gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<style>table{border: 1px solid gray;width: 100%;}th,td{border: 1px solid gray;text-align: center;}th{padding: 5px;}</style>'; $content.='<table> <thead> <tr style="background: #c79e09; color: white;"> <th colspan="4">Cutting Unit</th> </tr> <tr> <th>Product Name</th> <th>User Name</th> <th>Quantity</th> <th>Assign Date</th> </tr> <thead> <tbody>'; foreach ($data as $d){ if($d->type==1 && $d->cutting_user_id!=0){ $user_content='<option value="0">Select User</option>'; if($user_data){ foreach($user_data as $user){ $user_content.='<option value="'.$user->id.'" '.(($d->cutting_user_id==$user->id)?'selected="selected"':"").'>'.$user->first_name. "" . $user->last_name.'</option>'; } }else{ $user_content.='<option value="">No Data Available</option>'; } $content.='<tr> <td> <select id="products" name="cutting_products[]" class="form-control tip" style="width:100%;color: red;text-align: center;font-weight: bold;font-size: 17px;" disabled="true"> <option value="'.$d->product_id.'">'.$d->product_name.'</option> </select> </td> <td> <select id="user_name_'.$d->id.'" name="cutting_user_name[]" class="form-control tip" style="width:100%;" disabled="true"> '.$user_content.' </td> <td>'.number_format("$d->quantity").'</td> <td>'.date('d-m-Y', strtotime($d->cutting_assign_date)).'</td> </tr>'; } } $content.='</tbody></table>'; $content.='</div>'; } if(2==2){ $content.='<div class="row" style="padding: 0px 0px 0px 0px; border: 1px double gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<style>table{border: 1px solid gray;width: 100%;}th,td{border: 1px solid gray;text-align: center;}th{padding: 5px;}</style>'; $content.='<table> <thead> <tr style="background: #c79e09; color: white;"> <th colspan="4">Stitching Unit</th> </tr> <tr> <th>Product Name</th> <th>User Name</th> <th>Quantity</th> <th>Assign Date</th> </tr> <thead> <tbody>'; foreach ($data as $d){ if($d->type==2 && $d->stitching_user_id!=0){ $user_content='<option value="0">Select User</option>'; if($user_data){ foreach($user_data as $user){ $user_content.='<option value="'.$user->id.'" '.(($d->stitching_user_id==$user->id)?'selected="selected"':"").'>'.$user->first_name. "" . $user->last_name.'</option>'; } }else{ $user_content.='<option value="">No Data Available</option>'; } $content.='<tr> <td> <select id="products" name="cutting_products[]" class="form-control tip" style="width:100%;color: red;text-align: center;font-weight: bold;font-size: 17px;" disabled="true"> <option value="'.$d->product_id.'">'.$d->product_name.'</option> </select> </td> <td> <select id="user_name_'.$d->id.'" name="cutting_user_name[]" class="form-control tip" style="width:100%;" disabled="true"> '.$user_content.' </td> <td>'.number_format("$d->quantity").'</td> <td>'.date('d-m-Y', strtotime($d->stitching_assign_date)).'</td> </tr>'; } } $content.='</tbody></table>'; $content.='</div>'; } if(3==3){ $content.='<div class="row" style="padding: 0px 0px 0px 0px; border: 1px double gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<style>table{border: 1px solid gray;width: 100%;}th,td{border: 1px solid gray;text-align: center;}th{padding: 5px;}</style>'; $content.='<table> <thead> <tr style="background: #c79e09; color: white;"> <th colspan="3">Ready to Delivery Products</th> </tr> <tr> <th>Product Name</th> <th>Quantity</th> <th>Delivery Status</th> </tr> <thead> <tbody>'; foreach ($data as $d){ if($d->type==3 && $d->ready_or_not_ready!=""){ $content.='<tr> <td> <select id="products" name="cutting_products[]" class="form-control tip" style="width:100%;" disabled="true"> <option value="'.$d->product_id.'">'.$d->product_name.'</option> </select> </td> <td>'.number_format("$d->quantity").'</td> <td> <select id="ready_or_not_ready" name="ready_or_not_ready[]" class="form-control tip" style="width:100%;" disabled="true"> <option value="ready" '.(($d->ready_or_not_ready=='ready')?'selected="selected"':"").'>Ready</option> <option value="not_ready" '.(($d->ready_or_not_ready=='not_ready')?'selected="selected"':"").'>Not Ready</option> </select> </td> </tr>'; } } $content.='</tbody></table>'; $content.='</div>'; } if(4==4){ $content.='<div class="row" style="padding: 0px 0px 0px 0px; border: 1px double gray; border-radius: 5px; margin-top: 15px;background: #f1eded;">'; $content.='<style>table{border: 1px solid gray;width: 100%;}th,td{border: 1px solid gray;text-align: center;}th{padding: 5px;}</style>'; $content.='<table> <thead> <tr style="background: #c79e09; color: white;"> <th colspan="3">Order Delivery Date</th> </tr> <tr> <th>Product Name</th> <th>Quantity</th> <th>Delivery Date</th> </tr> <thead> <tbody>'; foreach ($data as $d){ if($d->type==4){ $content.='<tr> <td> <select id="products" name="cutting_products[]" class="form-control tip" style="width:100%; color: red; text-align: center;font-weight: bold;font-size: 17px;" disabled="true"> <option value="'.$d->product_id.'">'.$d->product_name.'</option> </select> </td> <td>'.number_format("$d->quantity").'</td> <td>'.date('d-m-Y', strtotime($d->delivery_date)).'</td> </tr>'; } } $content.='</tbody></table>'; $content.='</div>'; } }else{ $content.='No Data Available'; } echo $content; } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Histoty Endss Here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // *************************** Send SMS ******************************* // public function send_sms_form() { $sms_sales_id = $this->input->get('sms_sale_id'); $sales_data = $this->sales_model->getSaleDetailsByID($sms_sales_id); if($sales_data){ foreach($sales_data as $sales){ $content='<div class="row"> <div class="col-md-12"> <label for="products">SMS Content</label> <textarea name="sms_content" rows="5" class="form-control">Hai, '.$sales->customer_name.'</textarea> </div> <div class="col-md-3" style="padding-top: 10px;"> <input type="submit" name="send_sms" class="btn btn-primary" value="Send SMS"/> </div> </div>'; } } echo $content; } // *************************** Send SMS ******************************* // }