EVOLUTION-NINJA
Edit File: Marketing.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Marketing extends CI_Controller { public function __construct() { parent::__construct(); $this->check_islogin(); //check user login session exist or not $this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT'); $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); $this->output->set_header('Pragma: no-cache'); $this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); $this->load->model('yarn_model'); $this->load->model('marketing_model'); $this->load->model('planning_yarn'); $this->load->model('planning_shade'); $this->load->model('request_model'); $this->load->model('vendor_model'); $this->load->model('store_model'); $this->load->model('design_weaving_model'); date_default_timezone_set('asia/kolkata'); } //Checking the Login or not private function check_islogin() { if (!$this->session->userdata('logged_in')) { redirect(base_url(), 'refresh'); } } public function session_data_pass() { if($this->session->userdata('logged_in')) { return $this->yarn_model->get_userdata(); } } public function disp_alpha_filenos_custum() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); ?> <?php $alphachar = $_REQUEST['osl_num']; $table='orders'; $where=array('oslNo'=>$alphachar); $getcustname = $this->store_model->fetch_where_subgrid_data($table,$where); ?> <option value="<?php echo $getcustname->fileNo; ?>"><?php echo $getcustname->fileNo; ?></option> <?php } public function split_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); //<!------------------------ stock ---------------------------------> if($data['emp_details']->designation == 'PPC Manager' || $data['emp_details']->designation == 'PPC Executive' || $data['emp_details']->designation == 'ACCOUNTS' || $data['emp_details']->designation == 'Accounts' || $data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin') { $ttt1=date('d/m/Y'); $ddd1=date('d-m-Y'); $table='fabric_inspection_details'; $where=array('received_date'=>$ttt1,'split_noti'=>'Yes','insert_notification_status'=>0); $data['stock_split_data_res_count']=$this->vendor_model->fabric_inspection_split_count_amount_get_customerdata($table,$where); $ttt=date('d/m/Y'); $table='fabric_madeups_delivery_confirmation'; $where=array('rec_date'=>$ttt,'split_noti'=>'Yes','insert_notification_status'=>0); $data['stock_madeups_split_data_res_count']=$this->vendor_model->fabric_inspection_split_count_amount_get_customerdata($table,$where); } else { $data['stock_split_data_res_count']=0; $data['stock_madeups_split_data_res_count']=0; } $stock=$data['stock_split_data_res_count'] + $data['stock_madeups_split_data_res_count']; return $stock; } public function access_details_id() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_by); $d=$this->marketing_model->fetch_main_data($table,$where); $data['user_type_id']=$d->user_type_id; $table='swansilk_access_controls'; $where=array('department_id'=>$data['user_type_id']); return $this->marketing_model->fetch_main_data($table,$where); } public function indent_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); //<!------------------------ indent ---------------------------------> if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin' || $data['emp_details']->designation == 'HO Purchase Admin' ) { $d=date('d-m-Y'); $table='indent_add_indent'; $where=array('indented_date'=>$d,'insert_notification_status'=>0); $indent_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='indent_add_indent'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $indent_update_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='indent_add_indent'; $where=array('approved_date'=>$d,'approval_notification_status'=>0); $indent_approval_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $indent_insert_rows=0; $indent_update_rows=0; $indent_approval_rows=0; } //<!------------------------ po ---------------------------------> if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin') { $d=date('d-m-Y'); $table='indent_po'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $indent_po_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $indent_po_insert_rows1=0; } if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin' || $data['emp_details']->designation == 'HO Purchase Admin' ) { $d=date('d-m-Y'); $table='indent_po'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $indent_po_update_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='indent_po'; $where=array('approved_date'=>$d,'approval_notification_status'=>0); $indent_po_approval_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $indent_po_update_rows1=0; $indent_po_approval_rows1=0; } $r=$indent_insert_rows + $indent_update_rows + $indent_approval_rows + $indent_po_insert_rows1 + $indent_po_update_rows1 + $indent_po_approval_rows1; return $r; } public function stock_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); //<!------------------------ stock ---------------------------------> if($data['emp_details']->designation == 'PPC Manager' || $data['emp_details']->designation == 'PPC Executive' || $data['emp_details']->designation == 'ACCOUNTS' || $data['emp_details']->designation == 'Accounts') { $d=date('d-m-Y'); $table='fabric_transfer'; $where=array('transfer_date'=>$d,'insert_notification_status'=>0); $data['stoct_transfer_rows']=$this->vendor_model->count_amount_notification_get_customerdata($table,$where); $d=date('d-m-Y'); $table='swan_yarn_transfer'; $where=array('transfer_date'=>$d,'insert_notification_status'=>0); $data['stoct_transfer_rows1']=$this->vendor_model->count_amount_notification_get_customerdata($table,$where); $d=date('d-m-Y'); $table='yarn_transfer'; $where=array('transfer_date'=>$d,'insert_notification_status'=>0); $data['stoct_transfer_rows2']=$this->vendor_model->count_amount_notification_get_customerdata($table,$where); } else { $data['stoct_transfer_rows']=0; $data['stoct_transfer_rows1']=0; $data['stoct_transfer_rows2']=0; } if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin') { $ttt1=date('d/m/Y'); $ddd1=date('d-m-Y'); $table='fabric_inspection_details'; $where=array('received_date'=>$ttt1); $where1=array('received_date'=>$ddd1); $data['stock_split_data']=$this->vendor_model->fabric_inspection_split_count_amount_get_customerdata($table,$where,$where1); //"(status='live' OR status='dead')" $d=date('d-m-Y'); $table='cs_transfer'; $where=array('transfer_date'=>$d,'insert_notification_status'=>0); $data['stoct_transfer_rows3']=$this->vendor_model->count_amount_notification_get_customerdata($table,$where); } else { $data['stoct_transfer_rows3']=0; $data['stock_split_data']=0; } $stock=$data['stoct_transfer_rows'] + $data['stoct_transfer_rows1'] + $data['stoct_transfer_rows2'] + $data['stoct_transfer_rows3'] + $data['stock_split_data']; return $stock; } public function rec_stock_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin') { //<!---------------------- received stock ------------------------------> $d=date('d-m-Y'); $table='fabric_transfer'; $where=array('rec_date'=>$d,'update_notification_status'=>0); $data['rec_stoct_transfer_rows']=$this->vendor_model->count_amount_notification_get_customerdata($table,$where); $d=date('d-m-Y'); $table='swan_yarn_transfer'; $where=array('rec_date'=>$d,'update_notification_status'=>0); $data['rec_stoct_transfer_rows1']=$this->vendor_model->count_amount_notification_get_customerdata($table,$where); $d=date('d-m-Y'); $table='yarn_transfer'; $where=array('rec_date'=>$d,'update_notification_status'=>0); $data['rec_stoct_transfer_rows2']=$this->vendor_model->count_amount_notification_get_customerdata($table,$where); } else { $data['rec_stoct_transfer_rows']=0; $data['rec_stoct_transfer_rows1']=0; $data['rec_stoct_transfer_rows2']=0; } if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin') { $d=date('d-m-Y'); $table='cs_transfer'; $where=array('rec_date'=>$d,'update_notification_status'=>0); $data['rec_stoct_transfer_rows3']=$this->vendor_model->count_amount_notification_get_customerdata($table,$where); } else { $data['rec_stoct_transfer_rows3']=0; } //$data['total_rec_stock_notifications']=$data['rec_stoct_transfer_rows'] + $data['rec_stoct_transfer_rows1'] + $data['rec_stoct_transfer_rows2'] + $data['rec_stoct_transfer_rows3'] ; $rec_stock=$data['rec_stoct_transfer_rows'] + $data['rec_stoct_transfer_rows1'] + $data['rec_stoct_transfer_rows2'] + $data['rec_stoct_transfer_rows3']; return $rec_stock; } public function marketing_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin') { //<!---------------------- Marketing Module ------------------------------> $d=date('d-m-Y'); $where=$d; $data['marketing_rows']=$this->vendor_model->marketing_notification_getsuborder($where); $data['marketing_confirm_rows']=$this->vendor_model->marketing_notification_confirm_getsuborder($where); $data['marketing_update_num_rows']=$this->vendor_model->marketing_notification_update_getsuborder($where); $d=date('Y-m-d'); $where=$d; $data['marketing_on_date_rows']=$this->vendor_model->marketing_notification_delivery_date_getsuborder($where); $befdore_ten=date('Y-m-d',strtotime('+10 days')) . PHP_EOL; $data['marketing_ten_days_rows']=$this->vendor_model->marketing_notification_delivery_date_getsuborder($befdore_ten); $befdore_thirty=date('Y-m-d',strtotime('+30 days')) . PHP_EOL; $data['marketing_thirty_days_rows']=$this->vendor_model->marketing_notification_delivery_date_getsuborder($befdore_thirty); } else { $data['marketing_rows'] = 0; $data['marketing_confirm_rows'] = 0; $data['marketing_update_num_rows'] = 0; $data['marketing_on_date_rows'] = 0; $data['marketing_ten_days_rows'] = 0; $data['marketing_thirty_days_rows'] = 0; } $mark= $data['marketing_rows'] + $data['marketing_confirm_rows'] + $data['marketing_update_num_rows'] + $data['marketing_on_date_rows'] + $data['marketing_ten_days_rows'] + $data['marketing_thirty_days_rows']; return $mark; } public function issue_loom_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); //<!------------------------ issue_loom ---------------------------------> if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin' || $data['emp_details']->designation == 'PPC Manager' || $data['emp_details']->designation == 'PPC Executive' ) { $d=date('d-m-Y'); $table='issue_loom'; $where=array('issued_date'=>$d,'insert_notification_status'=>0); $indent_insert_rows=$this->vendor_model->count_of_pcs($table,$where); $d=date('d-m-Y'); $table='issue_loom'; $where=array('rements_approved_date'=>$d,'update_notification_status'=>0); $indent_update_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='weaving_panel_planning_order'; $where=array('issue_approved_date'=>$d,'approval_notification_status'=>0); $indent_approval_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $indent_insert_rows=0; $indent_approval_rows=0; $indent_update_rows=0; } $r=$indent_insert_rows + $indent_approval_rows + $indent_update_rows; return $r; } public function issue_fabric_page_notifications() { //<!---------------------- issue fabric Module ------------------------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin') { $d=date('d-m-Y'); $table='fabric_addstock'; $where=array('created_at'=>$d,'insert_notification_status'=>0); $f=$this->vendor_model->issue_fabric_count_amount_get_customerdata($table,$where); } else { $f=0; } // $mark= $data['marketing_rows'] + $data['marketing_confirm_rows'] + $data['marketing_update_num_rows'] + $data['marketing_on_date_rows'] + $data['marketing_ten_days_rows'] + $data['marketing_thirty_days_rows']; return $f; } public function issue_cs_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin') { //<!---------------------- issue cs Module ------------------------------> $d=date('d-m-Y'); $table='cs_addstock'; $where=array('created_at'=>$d,'insert_notification_status'=>0); $cs=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $cs=0; } return $cs; } public function planning_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin' || $data['emp_details']->designation == 'MARKETING' || $data['emp_details']->designation == 'Marketing') { // //<!---------------------- Planning Module ------------------------------> $d=date('d-m-Y'); $data['planning_order_rows'] = $this->vendor_model->planning_notification_get_details($d); $dd=date('Y-m-d'); $where=$dd; $data['pallning_outsource_rows']=$this->vendor_model->outsource_planning_notification_get_details($where); $d=date('Y-m-d'); $where=$d; $data['planned_dyeing_on_date_rows']=$this->vendor_model->marketing_notification_deying_date_getsuborder($where); $data['planned_weaving_on_date_rows']=$this->vendor_model->marketing_notification_weaving_date_getsuborder($where); $befdore_seven=date('Y-m-d',strtotime('+7 days')) . PHP_EOL; $data['planned_dyeing_sevenn_days_rows']=$this->vendor_model->marketing_notification_deying_date_getsuborder($befdore_seven); $data['planned_weaving_sevenn_days_rows']=$this->vendor_model->marketing_notification_weaving_date_getsuborder($befdore_seven); $after_five=date('Y-m-d',strtotime('-5 days')) . PHP_EOL; $data['planned_dyeing_five_days_rows']=$this->vendor_model->marketing_notification_deying_date_getsuborder($after_five); $data['planned_weaving_five_days_rows']=$this->vendor_model->marketing_notification_weaving_date_getsuborder($after_five); } else { $data['planning_order_rows'] =0; $data['pallning_outsource_rows']=0; $data['planned_dyeing_on_date_rows'] =0; $data['planned_dyeing_sevenn_days_rows'] =0; $data['planned_dyeing_five_days_rows']=0; $data['planned_weaving_on_date_rows'] =0; $data['planned_weaving_sevenn_days_rows'] =0; $data['planned_weaving_five_days_rows']=0; } $p=$data['planning_order_rows'] + $data['pallning_outsource_rows'] + $data['planned_dyeing_on_date_rows'] + $data['planned_dyeing_sevenn_days_rows'] + $data['planned_dyeing_five_days_rows'] + $data['planned_weaving_on_date_rows'] + $data['planned_weaving_sevenn_days_rows'] + $data['planned_weaving_five_days_rows'] ; return $p; } public function sample_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $emp_details=$this->vendor_model->get_customerdata($table,$where); if($emp_details->designation == 'Super Admin' || $emp_details->designation == 'Admin') { //<!------------------------ Sample request ---------------------------------> $d=date('d-m-Y'); $table='sample_request'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $sample_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $sample_insert_rows=0; } if($emp_details->designation == 'Super Admin') { $d=date('d-m-Y'); $table='sample_request'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $sample_update_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $sample_update_rows=0; } $s= $sample_insert_rows + $sample_update_rows ; return $s; } public function work_order_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin' || $data['emp_details']->designation == 'PPC Manager') { //<!---------------------- work order ------------------------------> $d=date('d-m-Y'); $table='create_yarntwisting_work_order'; $where=array('created_at'=>$d,'insert_notification_status'=>0); $data['work_order_twisting']=$this->vendor_model->count_amount_work_order_get_customerdata($table,$where); $d=date('d-m-Y'); $table='workorder_dyeing'; $where=array('created_at'=>$d,'insert_notification_status'=>0); $data['work_order_dyeing']=$this->vendor_model->count_amount_work_order_get_customerdata($table,$where); $d=date('d-m-Y'); $table='workorder_dyeing_material'; $where=array('approved_date'=>$d,'insert_notification_status'=>0); $data['issue_work_order_dyeing_material_rows']=$this->vendor_model->count_amount_work_order_get_customerdata($table,$where); $d=date('d-m-Y'); $table='finishing_embroidry'; $where=array('created_at'=>$d,'insert_notification_status'=>0); $data['work_order_fabric_finishing']=$this->vendor_model->count_amount_work_order_get_customerdata($table,$where); $d=date('d-m-Y'); $table='work_order_twisting'; $where=array('rec_date'=>$d,'insert_notification_status'=>0); $data['work_order_delivery_twisting_finishing']=$this->vendor_model->count_amount_work_order_delivery_twisting_get_customerdata($table,$where); $d=date('d-m-Y'); $table='work_order_dyeing'; $where=array('rec_date'=>$d,'insert_notification_status'=>0); $data['work_order_delivery_dyeing_finishing']=$this->vendor_model->count_amount_work_order_delivery_dyed_get_customerdata($table,$where); $d=date('d-m-Y'); $table='weaving_factory_stock'; $where=array('rec_date'=>$d,'insert_notification_status'=>0); $data['work_order_delivery_weaving_finishing']=$this->vendor_model->count_amount_work_order_delivery_weaving_fabric_get_customerdata($table,$where); $d=date('d/m/Y'); $table='finishing_embroidry_stock'; $where=array('received_date'=>$d,'insert_notification_status'=>0); $data['work_order_delivery_finishing_finishing']=$this->vendor_model->count_amount_work_order_delivery_fabric_finishing_emp_get_customerdata($table,$where); } else { $data['work_order_twisting']=0; $data['work_order_dyeing']=0; $data['work_order_fabric_finishing']=0; $data['work_order_delivery_twisting_finishing']=0; $data['work_order_delivery_dyeing_finishing']=0; $data['work_order_delivery_weaving_finishing']=0; $data['work_order_delivery_finishing_finishing']=0; $data['issue_work_order_dyeing_material_rows']=0; } $w=$data['work_order_twisting'] + $data['work_order_dyeing'] + $data['work_order_fabric_finishing'] + $data['work_order_delivery_twisting_finishing'] + $data['work_order_delivery_dyeing_finishing'] + $data['work_order_delivery_weaving_finishing'] + $data['work_order_delivery_finishing_finishing'] + $data['issue_work_order_dyeing_material_rows']; return $w; } public function packing_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); //<!------------------------ package list ---------------------------------> if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin' || $data['emp_details']->designation == 'Marketing' || $data['emp_details']->designation == 'MARKETING' || $data['emp_details']->designation == 'HO Marketing' || $data['emp_details']->designation == 'HO Marketing') { $d=date('d/m/Y'); $table='packing_list_data'; $where=array('created_at'=>$d,'insert_notification_status'=>0); $package_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='packing_list_data'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $package_update_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d/m/Y'); $table='madeups_list_data'; $where=array('created_at'=>$d,'insert_notification_status'=>0); $package_madeups_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $package_insert_rows=0; $package_update_rows=0; $package_madeups_insert_rows=0; } $packing= $package_insert_rows + $package_update_rows + $package_madeups_insert_rows; return $packing; } public function design_weaving_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); //<!------------------------ design weaving list ---------------------------------> if($data['emp_details']->designation == 'Super Admin') { $d=date('d-m-Y'); $table='design_weave'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $design_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='design_weave'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $design_update_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='design_weave'; $where=array('finalized_date'=>$d,'finalize_notification_status'=>0); $design_finalize_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='design_weave'; $where=array('approved_date'=>$d,'approval_notification_status'=>0); $design_approval_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $design_insert_rows=0; $design_update_rows=0; $design_finalize_rows=0; $design_approval_rows=0; } $design= $design_insert_rows + $design_update_rows + $design_finalize_rows + $design_approval_rows; return $design; } public function masters_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); //<!----------------------------- Masters Module ---------------------------------------> if($data['emp_details']->designation == 'Super Admin' ) { $d=date('d-m-Y'); $table='import_yarn'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $yarn_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='import_yarn'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $yarn_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='article_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $article_updated_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='fabric_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $fabric_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='fabric_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $fabric_upadted_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='shade_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $shade_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='shade_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $shade_updated_row=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='color_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $color_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='color_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $color_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='customer_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $customer_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='box_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $box_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='madeups_box_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $madeups_box_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='product_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $product_master_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $yarn_insert_rows=0; $yarn_insert_rows1=0; $article_updated_rows=0; $fabric_insert_rows=0; $fabric_upadted_rows=0; $shade_insert_rows=0; $shade_updated_row=0; $color_insert_rows=0; $color_insert_rows1=0; $customer_insert_rows1=0; $box_insert_rows1=0; $madeups_box_insert_rows1=0; $product_master_insert_rows1=0; } if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'MARKETING' || $data['emp_details']->designation == 'Marketing' || $data['emp_details']->designation == 'Marketing' || $data['emp_details']->designation == 'HO Marketing' || $data['emp_details']->designation == 'HO Marketing') { $d=date('d-m-Y'); $table='article_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $article_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='design_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $design_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $article_insert_rows=0; $design_insert_rows=0; } if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin' || $data['emp_details']->designation == 'HO Purchase Admin') { $d=date('d-m-Y'); $table='indent_product'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $indent_product_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='indent_vendor_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $indent_vednor_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $indent_product_insert_rows1=0; $indent_vednor_insert_rows1=0; } if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin') { $d=date('d-m-Y'); $table='design_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $design_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='customer_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $customer_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='box_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $box_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='madeups_box_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $madeups_box_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='outsource_vendor_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $outsource_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='outsource_vendor_master'; $where=array('updated_on'=>$d,'update_notification_status'=>0); $outsource_insert_rows1=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='indent_vendor_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $indent_vednor_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='indent_product'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $indent_product_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d-m-Y'); $table='product_master'; $where=array('created_date'=>$d,'insert_notification_status'=>0); $product_master_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); } else { $design_insert_rows1=0; $customer_insert_rows=0; $box_insert_rows=0; $outsource_insert_rows=0; $outsource_insert_rows1=0; $indent_vednor_insert_rows=0; $indent_product_insert_rows=0; $product_master_insert_rows=0; $madeups_box_insert_rows=0; } $m=$yarn_insert_rows + $yarn_insert_rows1 + $article_insert_rows + $article_updated_rows + $fabric_insert_rows + $fabric_upadted_rows + $shade_updated_row + $design_insert_rows + $design_insert_rows1 + $color_insert_rows + $color_insert_rows1 + $customer_insert_rows + $customer_insert_rows1 + $box_insert_rows + $box_insert_rows1 + $outsource_insert_rows + $outsource_insert_rows1 + $indent_vednor_insert_rows + $indent_vednor_insert_rows1 + $indent_product_insert_rows + $indent_product_insert_rows1 + $product_master_insert_rows + $product_master_insert_rows1 + $madeups_box_insert_rows1 + $madeups_box_insert_rows; return $m; } public function madeups_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); //<!------------------------ madeups list ---------------------------------> if($data['emp_details']->designation == 'HO Madeups') { $d=date('d/m/Y'); $table='fabric_madeups'; $where=array('created_at'=>$d,'insert_notification_status'=>0); $madeups_list_insert_rows=$this->vendor_model->count_amount_get_customerdata($table,$where); $d=date('d/m/Y'); $table='consumable_madeups'; $where=array('created_at'=>$d,'insert_notification_status'=>0); $madeups_list_madeups_insert_rows=$this->vendor_model->madeups_count_amount_get_customerdata($table,$where); } else { $madeups_list_insert_rows=0; $madeups_list_madeups_insert_rows=0; } if($data['emp_details']->designation == 'PPC Manager' || $data['emp_details']->designation == 'PPC Executive') { $input=date('d/m/Y'); $datee = explode('/', $input); $day = $datee[0]; $month = $datee[1]; $year = $datee[2]; $rr=substr($month, 0, 1); $rr1=substr($month, 1, 2); $rrr=substr($day, 0, 1); $rrr1=substr($day, 1, 2); if($rr == '0' && $rrr == '0') { $t=$rrr1 . '/' . $rr1 . '/' . $year; //$t=$day . '/' . $rr1 . '/' . $year; $table='fabric_madeups_delivery_confirmation'; $where=array('rec_date'=>$t,'insert_notification_status'=>0); $madeups_list_madeups_delivery_insert_rows=$this->vendor_model->madeups_count_amount_get_customerdata($table,$where); } else if($rr == '0' && $rrr != '0') { //$t=$rrr1 . '/' . $rr1 . '/' . $year; $t=$day . '/' . $rr1 . '/' . $year; $table='fabric_madeups_delivery_confirmation'; $where=array('rec_date'=>$t,'insert_notification_status'=>0); $madeups_list_madeups_delivery_insert_rows=$this->vendor_model->madeups_count_amount_get_customerdata($table,$where); } else if($rr != '0' && $rrr == '0') { //$t=$rrr1 . '/' . $rr1 . '/' . $year; $t=$rrr1 . '/' . $month . '/' . $year; $table='fabric_madeups_delivery_confirmation'; $where=array('rec_date'=>$t,'insert_notification_status'=>0); $madeups_list_madeups_delivery_insert_rows=$this->vendor_model->madeups_count_amount_get_customerdata($table,$where); } else if($rr != '0' && $rrr != '0') { $table='fabric_madeups_delivery_confirmation'; $where=array('rec_date'=>$input,'insert_notification_status'=>0); $madeups_list_madeups_delivery_insert_rows=$this->vendor_model->madeups_count_amount_get_customerdata($table,$where); } } else { $madeups_list_madeups_delivery_insert_rows=0; } $madeups = $madeups_list_insert_rows + $madeups_list_madeups_insert_rows + $madeups_list_madeups_delivery_insert_rows; return $madeups; } public function inward_purchases_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $table='date_notification'; $where=array('status'=>0); $date_wise_data=$this->vendor_model->get_customerdata($table,$where); $data['date_rel_data']=$this->vendor_model->get_customerdata($table,$where); $d=$date_wise_data->req_date; if($date_wise_data->module_status == 'old') { if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin' || $data['emp_details']->designation == 'PPC Manager' ) { $table='indent_yarn_goods_details'; $where=array('received_date'=>$d); $data['yarn_delivery_inserted_rows']=$this->vendor_model->yarn_delivery1_insert_getsuborder1($d); $data['yarn_delivery_insert_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where); //$d=date('d-m-Y'); $table='indent_cs_goods_details'; $where=array('received_date'=>$d); $data['cs_delivery_inserted_rows1']=$this->vendor_model->cs_delivery_insertt_getsuborder1($d); $data['cs_delivery_insert_rows1']=$this->vendor_model->count_amount_get_customerdata($table,$where); $newDate = date("d/m/Y", strtotime($d)); //$d=date('d/m/Y'); $table='indent_cs_goods_details'; $where=array('received_date'=>$newDate); $data['cs_delivery_inserted_rows']=$this->vendor_model->cs_delivery_insertt_getsuborder1($newDate); $data['cs_delivery_insert_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where); $input=$newDate; $datee = explode('/', $input); $day = $datee[0]; $month = $datee[1]; $year = $datee[2]; $rr=substr($month, 0, 1); $rr1=substr($month, 1, 2); $rrr=substr($day, 0, 1); $rrr1=substr($day, 1, 2); $t1=$rrr1 . '/' . $rr1 . '/' . $year; $table='indent_goods_details'; $where=$t1; $where1=array('received_date'=>$t1); $data['fabric_delivery_inserted_rows1']=$this->vendor_model->fabric_delivery_goods_insertt_getsuborder1($where); $data['fabric_delivery_insert_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $t2=$day . '/' . $rr1 . '/' . $year; $table='indent_goods_details'; $where=$t2; $where1=array('received_date'=>$t2); $data['fabric_delivery_inserted_rows2']=$this->vendor_model->fabric_delivery_goods_insertt_getsuborder1($where); $data['fabric_delivery_insert_rows2']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $t3=$rrr1 . '/' . $month . '/' . $year; $table='indent_goods_details'; $where=$t3; $where1=array('received_date'=>$t3); $data['fabric_delivery_inserted_rows3']=$this->vendor_model->fabric_delivery_goods_insertt_getsuborder1($where); $data['fabric_delivery_insert_rows3']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $table='indent_goods_details'; $where=$input; $where1=array('received_date'=>$input); $data['fabric_delivery_inserted_rows4']=$this->vendor_model->fabric_delivery_goods_insertt_getsuborder1($where); $data['fabric_delivery_insert_rows4']=$this->vendor_model->count_amount_get_customerdata($table,$where1); } else { $data['yarn_delivery_insert_rows']=0; $data['cs_delivery_insert_rows1']=0; $data['cs_delivery_insert_rows']=0; $data['fabric_delivery_insert_rows']=0; $data['fabric_delivery_insert_rows2']=0; $data['fabric_delivery_insert_rows3']=0; $data['fabric_delivery_insert_rows4']=0; } } else { if($data['emp_details']->designation == 'Super Admin' || $data['emp_details']->designation == 'Admin' || $data['emp_details']->designation == 'PPC Manager' ) { // $d=date('d-m-Y'); $table='indent_yarn_goods_details'; $where=array('received_date'=>$d,'insert_notification_status'=>0); $data['yarn_delivery_inserted_rows']=$this->vendor_model->yarn_delivery_insert_getsuborder1($d); $data['yarn_delivery_insert_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where); //$d=date('d-m-Y'); $table='indent_cs_goods_details'; $where=array('received_date'=>$d,'insert_notification_status'=>0); $data['cs_delivery_inserted_rows1']=$this->vendor_model->cs_delivery_insert_getsuborder1($d); $data['cs_delivery_insert_rows1']=$this->vendor_model->count_amount_get_customerdata($table,$where); $newDate = date("d/m/Y", strtotime($d)); //$d=date('d/m/Y'); $table='indent_cs_goods_details'; $where=array('received_date'=>$newDate,'insert_notification_status'=>0); $data['cs_delivery_inserted_rows']=$this->vendor_model->cs_delivery_insert_getsuborder1($newDate); $data['cs_delivery_insert_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where); $input=$newDate; $datee = explode('/', $input); $day = $datee[0]; $month = $datee[1]; $year = $datee[2]; $rr=substr($month, 0, 1); $rr1=substr($month, 1, 2); $rrr=substr($day, 0, 1); $rrr1=substr($day, 1, 2); $t1=$rrr1 . '/' . $rr1 . '/' . $year; $table='indent_goods_details'; $where=$t1; $where1=array('received_date'=>$t1,'insert_notification_status'=>0); $data['fabric_delivery_inserted_rows1']=$this->vendor_model->fabric_delivery_goods_insert_getsuborder1($where); $data['fabric_delivery_insert_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $t2=$day . '/' . $rr1 . '/' . $year; $table='indent_goods_details'; $where=$t2; $where1=array('received_date'=>$t2,'insert_notification_status'=>0); $data['fabric_delivery_inserted_rows2']=$this->vendor_model->fabric_delivery_goods_insert_getsuborder1($where); $data['fabric_delivery_insert_rows2']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $t3=$rrr1 . '/' . $month . '/' . $year; $table='indent_goods_details'; $where=$t3; $where1=array('received_date'=>$t3,'insert_notification_status'=>0); $data['fabric_delivery_inserted_rows3']=$this->vendor_model->fabric_delivery_goods_insert_getsuborder1($where); $data['fabric_delivery_insert_rows3']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $table='indent_goods_details'; $where=$input; $where1=array('received_date'=>$input,'insert_notification_status'=>0); $data['fabric_delivery_inserted_rows4']=$this->vendor_model->fabric_delivery_goods_insert_getsuborder1($where); $data['fabric_delivery_insert_rows4']=$this->vendor_model->count_amount_get_customerdata($table,$where1); } else { $data['yarn_delivery_insert_rows']=0; $data['cs_delivery_insert_rows1']=0; $data['cs_delivery_insert_rows']=0; $data['fabric_delivery_insert_rows']=0; $data['fabric_delivery_insert_rows2']=0; $data['fabric_delivery_insert_rows3']=0; $data['fabric_delivery_insert_rows4']=0; } } $data['total_res_inward_fabric']=$data['fabric_delivery_insert_rows'] + $data['fabric_delivery_insert_rows2'] + $data['fabric_delivery_insert_rows3'] + $data['fabric_delivery_insert_rows4'] + $data['yarn_delivery_insert_rows'] + $data['cs_delivery_insert_rows'] + $data['cs_delivery_insert_rows1']; $data['page_static']='inward_purchase'; $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications'];$data['access'] = $this->access_details(); $data['userdetails'] = $this->session_data_pass(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('vendor_master/notification_page',$data); $this->load->view('templates/footer_inside'); } public function inward_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $table='date_notification'; $where=array('status'=>0); $date_wise_data=$this->vendor_model->get_customerdata($table,$where); $data['date_rel_data']=$this->vendor_model->get_customerdata($table,$where); $d=$date_wise_data->req_date; //<!------------------------ new stores list ---------------------------------> // $d=date('d-m-Y'); $table='indent_yarn_goods_details'; $where=array('received_date'=>$d,'insert_notification_status'=>0); $data['yarn_delivery_inserted_rows']=$this->vendor_model->yarn_delivery_insert_getsuborder1($d); $data['yarn_delivery_insert_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where); //$d=date('d-m-Y'); $table='indent_cs_goods_details'; $where=array('received_date'=>$d,'insert_notification_status'=>0); $data['cs_delivery_inserted_rows1']=$this->vendor_model->cs_delivery_insert_getsuborder1($d); $data['cs_delivery_insert_rows1']=$this->vendor_model->count_amount_get_customerdata($table,$where); $newDate = date("d/m/Y", strtotime($d)); //$d=date('d/m/Y'); $table='indent_cs_goods_details'; $where=array('received_date'=>$newDate,'insert_notification_status'=>0); $data['cs_delivery_inserted_rows']=$this->vendor_model->cs_delivery_insert_getsuborder1($newDate); $data['cs_delivery_insert_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where); $input=$newDate; $datee = explode('/', $input); $day = $datee[0]; $month = $datee[1]; $year = $datee[2]; $rr=substr($month, 0, 1); $rr1=substr($month, 1, 2); $rrr=substr($day, 0, 1); $rrr1=substr($day, 1, 2); $t1=$rrr1 . '/' . $rr1 . '/' . $year; $table='indent_goods_details'; $where=$t1; $where1=array('received_date'=>$t1,'insert_notification_status'=>0); $data['fabric_delivery_inserted_rows1']=$this->vendor_model->fabric_delivery_goods_insert_getsuborder1($where); $data['fabric_delivery_insert_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $t2=$day . '/' . $rr1 . '/' . $year; $table='indent_goods_details'; $where=$t2; $where1=array('received_date'=>$t2,'insert_notification_status'=>0); $data['fabric_delivery_inserted_rows2']=$this->vendor_model->fabric_delivery_goods_insert_getsuborder1($where); $data['fabric_delivery_insert_rows2']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $t3=$rrr1 . '/' . $month . '/' . $year; $table='indent_goods_details'; $where=$t3; $where1=array('received_date'=>$t3,'insert_notification_status'=>0); $data['fabric_delivery_inserted_rows3']=$this->vendor_model->fabric_delivery_goods_insert_getsuborder1($where); $data['fabric_delivery_insert_rows3']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $table='indent_goods_details'; $where=$input; $where1=array('received_date'=>$input,'insert_notification_status'=>0); $data['fabric_delivery_inserted_rows4']=$this->vendor_model->fabric_delivery_goods_insert_getsuborder1($where); $data['fabric_delivery_insert_rows4']=$this->vendor_model->count_amount_get_customerdata($table,$where1); $new=$data['fabric_delivery_insert_rows'] + $data['fabric_delivery_insert_rows2'] + $data['fabric_delivery_insert_rows3'] + $data['fabric_delivery_insert_rows4'] + $data['yarn_delivery_insert_rows'] + $data['cs_delivery_insert_rows'] + $data['cs_delivery_insert_rows1']; // $new = $fabric_inpection_insert_rows + $fabric_delivery_insert_rows + $yarn_delivery_insert_rows + $cs_delivery_insert_rows; // print_r($new); // die(); return $new; } public function new_stores_page_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $table='date_notification'; $where=array('status'=>0); $date_wise_data=$this->vendor_model->get_customerdata($table,$where); $data['date_rel_data']=$this->vendor_model->get_customerdata($table,$where); $d=$date_wise_data->req_date; //<!------------------------ new stores list ---------------------------------> if($data['emp_details']->designation == 'PPC Manager' || $data['emp_details']->designation == 'PPC Executive' ) { //$d=date('d-m-Y'); $table='fabric_inspection'; $where=$d; $where1=array('created_date'=>$d,'insert_notification_status'=>0); $data['fabric_inspection_inserted_rows']=$this->vendor_model->fabric_inspection_update_getsuborder1($where); $data['fabric_inspection_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where1); } else { $data['fabric_inspection_inserted_rows']=array(); $data['fabric_inspection_rows']=0; } $new= $data['fabric_inspection_rows'] ; // $new = $fabric_inpection_insert_rows + $fabric_delivery_insert_rows + $yarn_delivery_insert_rows + $cs_delivery_insert_rows; // print_r($new); // die(); return $new; } public function fabric_inspection_notifications() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $table='date_notification'; $where=array('status'=>0); $date_wise_data=$this->vendor_model->get_customerdata($table,$where); $data['date_rel_data']=$this->vendor_model->get_customerdata($table,$where); $d=$date_wise_data->req_date; if($date_wise_data->module_status == 'old') { if($data['emp_details']->designation == 'PPC Manager' || $data['emp_details']->designation == 'PPC Executive' ) { //$d=date('d-m-Y'); $table='fabric_inspection'; $where=$d; $where1=array('created_date'=>$d); $data['fabric_inspection_inserted_rows']=$this->vendor_model->fabric_inspections_update_getsuborder1($where); $data['fabric_inspection_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where1); } else { $data['fabric_inspection_inserted_rows']=array(); $data['fabric_inspection_rows']=0; } } else { if($data['emp_details']->designation == 'PPC Manager' || $data['emp_details']->designation == 'PPC Executive' ) { //$d=date('d-m-Y'); $table='fabric_inspection'; $where=$d; $where1=array('created_date'=>$d,'insert_notification_status'=>0); $data['fabric_inspection_inserted_rows']=$this->vendor_model->fabric_inspection_update_getsuborder1($where); $data['fabric_inspection_rows']=$this->vendor_model->count_amount_get_customerdata($table,$where1); } else { $data['fabric_inspection_inserted_rows']=array(); $data['fabric_inspection_rows']=0; } } $data['total_res_fabric']= $data['fabric_inspection_rows'] ; $data['page_static']='fabric_inspection'; $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications'];$data['access'] = $this->access_details(); $data['userdetails'] = $this->session_data_pass(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('vendor_master/notification_page',$data); $this->load->view('templates/footer_inside'); } public function view_box_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $table='box_master'; $max_id=$this->marketing_model->fetch_uniqueno($table); if(empty($max_id)) { $data['max_uni']=1; } else { $data['max_uni']=$max_id->unique_no + 1; } $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/box_master_view', $data); $this->load->view('templates/footer_inside'); } public function view_account_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); print_r($id); die(); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/account_master_view', $data); $this->load->view('templates/footer_inside'); } public function box_master_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "/") + 12); // print_r($data['val']); //die(); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; //<!----add from-------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_id=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_id); $dept_id_row=$this->vendor_model->get_where_row($table,$where); $user_type_id_row=$dept_id_row->user_type_id; //----------tiill-------------------- $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $check=""; foreach($m_id as $menu_id) { $table='swansilk_menu'; $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); $result= $this->marketing_model->fetch_main_data($table,$where); if(!empty($result->reference_url)){ if($result->reference_url == $data['val']) { $check=$data['val']; } } } if($check != "") { //<!----add from -------------> $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $data1=array(); foreach($m_id as $menu_id) { $table='access_action_rights'; $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); $arr=$this->vendor_model->get_where_row($table,$where); if(empty($arr)) { } else { //print_r($arr); $menu_id=$arr->menu_id; $table='swansilk_menu'; $where=array('menu_id'=>$menu_id); $url=$this->vendor_model->get_where_row($table,$where); if(!empty($url->reference_url)){ if($url->reference_url == $data['val']) { $data['access_row']=$arr; } } } } //----------tiill-------------------- $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/box_master_details', $data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function account_master_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "/") + 12); // print_r($data['val']); //die(); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; //<!----add from-------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_id=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_id); $dept_id_row=$this->vendor_model->get_where_row($table,$where); $user_type_id_row=$dept_id_row->user_type_id; //----------tiill-------------------- $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $check=""; foreach($m_id as $menu_id) { $table='swansilk_menu'; $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); $result= $this->marketing_model->fetch_main_data($table,$where); if(!empty($result->reference_url)){ if($result->reference_url == $data['val']) { $check=$data['val']; } } } if($check != "") { //<!----add from -------------> $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $data1=array(); foreach($m_id as $menu_id) { $table='access_action_rights'; $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); $arr=$this->vendor_model->get_where_row($table,$where); if(empty($arr)) { } else { //print_r($arr); $menu_id=$arr->menu_id; $table='swansilk_menu'; $where=array('menu_id'=>$menu_id); $url=$this->vendor_model->get_where_row($table,$where); if(!empty($url->reference_url)){ if($url->reference_url == $data['val']) { $data['access_row']=$arr; } } } } //----------tiill-------------------- $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/account_master', $data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function customer_product_details($orderID = "") { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $where1=array('id'=>$orderID); $table1='customer_master'; $data['result']=$this->marketing_model->fetch_main_data($table1,$where1); $data['designdata'] = $this->marketing_model->display_design_data(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/view_customer_master_details', $data); $this->load->view('templates/footer_inside'); } public function articleNo_getDesignAndQuality() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $articleNo = $_REQUEST['articleNo']; $detail = $this->marketing_model->getArticleDetails($articleNo); echo json_encode($detail); } public function insert_view_customer_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $data=array('fileNo' =>$this->input->post('customer_id'), 'currency' =>$this->input->post('currencyName'), 'paymentTerms' =>$this->input->post('paymentTerms'), ); $table='orders'; $q=$this->vendor_model->insert_access($table,$data); $article =$this->input->post('articleNo'); if($article == '') { $article1 =$this->input->post('article_No'); } else { $article1 =$this->input->post('articleNo'); } $data2=array('orderID'=>$q, 'article_type' =>$this->input->post('production'), 'contractType' =>$this->input->post('contractType'), 'subOrderType' =>$this->input->post('subOrderType'), 'unit' =>$this->input->post('unit'), 'articleNo' =>$article1, 'weave' =>$this->input->post('design'), 'design' =>$this->input->post('dbdesign'), 'quality' =>$this->input->post('quality'), 'width' =>$this->input->post('width'), 'description' =>$this->input->post('description'), ); $table='sub_orders'; $qq=$this->vendor_model->insert_access($table,$data2); $data3=array('subOrderID'=>$qq, 'unitPrice' =>$this->input->post('unit_price'), 'quantity' =>$this->input->post('quan'), 'ourshade' =>$this->input->post('ourshade'), 'buyershade' =>$this->input->post('buyershade'), ); $table='sub_order_shades'; $insert_id=$this->design_weaving_model->insert_data($table,$data3); } public function customer_grid_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $get = $this->uri->segment(3); preg_match_all('!\d+!', $get, $matches); $id=""; foreach($matches as $matches) { $id=$matches; } $i= $id[0]; $where=array('id'=>$i); $table='customer_master'; $fetch_data=$this->vendor_model->get_customerdata($table,$where); $where1=$fetch_data->customerID; $detail = $this->marketing_model->customer_view_data($where1); echo json_encode($detail); } public function access_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_by); $d=$this->marketing_model->fetch_main_data($table,$where); $data['user_type_id']=$d->user_type_id; $table='swansilk_access_controls'; $where=array('department_id'=>$data['user_type_id']); return $this->marketing_model->fetch_where_data($table,$where); } public function access_id() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_by); $d=$this->marketing_model->fetch_main_data($table,$where); return $d->user_type_id; } public function customer_master_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "/") + 12); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; //<!----add from-------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_id=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_id); $dept_id_row=$this->vendor_model->get_where_row($table,$where); $user_type_id_row=$dept_id_row->user_type_id; //----------tiill-------------------- $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $check=""; foreach($m_id as $menu_id) { $table='swansilk_menu'; $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); $result= $this->marketing_model->fetch_main_data($table,$where); if(!empty($result->reference_url)){ if($result->reference_url == $data['val']) { $check=$data['val']; } } } if($check != "") { //<!----add from -------------> $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $data1=array(); foreach($m_id as $menu_id) { $table='access_action_rights'; $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); $arr=$this->vendor_model->get_where_row($table,$where); if(empty($arr)) { } else { //print_r($arr); $menu_id=$arr->menu_id; $table='swansilk_menu'; $where=array('menu_id'=>$menu_id); $url=$this->vendor_model->get_where_row($table,$where); if(!empty($url->reference_url)){ if($url->reference_url == $data['val']) { $data['access_row']=$arr; //$data['access_roww']=$arr; } } } } //----------tiill-------------------- // print_r($data['access_roww']); // die(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['userdetails'] = $this->session_data_pass(); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/customer_master_details', $data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function get_outsource_OslDetails() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $orderID = $_REQUEST['orderID']; $oslDetails = $this->marketing_model->get_outsource_osl_details($orderID); // print_r($oslDetails); // die(); $data['oslDetails'] = $oslDetails; // print_r($data['oslDetails']); // die(); $this->load->view('marketing/osl_details.php', $data); } public function add_customer() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $data['country'] = $this->yarn_model->getcountries(); $data['customermaster'] = $this->marketing_model->display_customer_data(); if ($this->input->post('submitcustomer')) { if ($this->input->post('opennotesdiv')) { $notes = implode(',', $this->input->post('notes')); } else { $notes = ""; } if ($this->input->post('openagentdetailsdiv')) { $agentname = $this->input->post('agentname'); $agentAddress = $this->input->post('agentAddress'); $agentContactperson = $this->input->post('agentcontactperson'); $agentMobile = implode(',', $this->input->post('agentmobile')); $agentPhone = implode(',', $this->input->post('agentphone')); $agentEmail = implode(',', $this->input->post('agentemail')); $agentWebsite = $this->input->post('agentwebsite'); $agentCommission = $this->input->post('agentCommission'); $agencyFromDate = explode("/", $this->input->post('agentValidityDate'))[2] . '-' . explode("/", $this->input->post('agentValidityDate'))[1] . '-' . explode("/", $this->input->post('agentValidityDate'))[0]; } else { $agentname = ""; $agentAddress = ""; $agentContactperson = ""; $agentMobile = ""; $agentPhone = ""; $agentEmail = ""; $agentWebsite = ""; $agentCommission = ""; $agencyFromDate = date("Y-m-d"); } $country=$this->input->post('country'); $query = $this->db->query('SELECT * FROM country where country="' . $country . '"'); $res = $query->row(); $idd=$this->session->userdata('logged_in'); $where=array('id'=>$idd); $data['approved_by']=$idd['username']; $d=date('d-m-Y'); $customer_data = array( 'customerName' => $this->input->post('customerName'), 'productType' => $this->input->post('productType'), 'customerID' => $this->input->post('customerid'), 'customerAddress' => $this->input->post('customerAddress'), 'city' => $this->input->post('city'), 'pincode' => $this->input->post('pincode'), 'country' => $res->id, 'bankerName' => $this->input->post('bankerName'), 'bankerAddress' => $this->input->post('bankerAddress'), 'department' => $this->input->post('department'), 'mobile' => implode(",", $this->input->post('mobileno')), 'phoneNo' => implode(",", $this->input->post('phoneno')), 'email' => implode(",", $this->input->post('email')), 'website' => implode(",", $this->input->post('website')), 'consigneeName' => $this->input->post('consigneename'), 'consigneeAddress' => $this->input->post('consigneeAddress'), 'notes' => $notes, 'agentName' => $agentname, 'agentAddress' => $agentAddress, 'agentContactperson' => $agentContactperson, 'agentMobile' => $agentMobile, 'agentPhone' => $agentPhone, 'agentEmail' => $agentEmail, 'agentWebsite' => $agentWebsite, 'agentCommission' => $agentCommission, 'agencyFromDate' => $agencyFromDate, 'created_by'=>$data['approved_by'], 'created_date'=>$d ); $cusinsert = $this->marketing_model->customer_insert($customer_data); if ($cusinsert) { redirect(base_url() . 'marketing/customer_master_details', 'refresh'); } } else { $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/add_customer', $data); $this->load->view('templates/footer_inside'); } } public function product_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "/") + 12); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; //<!----add from-------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_id=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_id); $dept_id_row=$this->vendor_model->get_where_row($table,$where); $user_type_id_row=$dept_id_row->user_type_id; //----------tiill-------------------- $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $check=""; foreach($m_id as $menu_id) { $table='swansilk_menu'; $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); $result= $this->marketing_model->fetch_main_data($table,$where); if(!empty($result->reference_url)){ if($result->reference_url == $data['val']) { $check=$data['val']; } } } if($check != "") { //<!----add from -------------> $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $data1=array(); foreach($m_id as $menu_id) { $table='access_action_rights'; $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); $arr=$this->vendor_model->get_where_row($table,$where); if(empty($arr)) { } else { //print_r($arr); $menu_id=$arr->menu_id; $table='swansilk_menu'; $where=array('menu_id'=>$menu_id); $url=$this->vendor_model->get_where_row($table,$where); if(!empty($url->reference_url)){ if($url->reference_url == $data['val']) { $data['access_row']=$arr; } } } } //----------tiill-------------------- $data['getalldata'] = $this->marketing_model->display_product_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/product_details', $data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function add_product() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); if ($this->input->post('submitproduct')) { $this->form_validation->set_rules('type', 'Type', 'trim|required|xss_clean|callback_uniq_producttype'); $this->form_validation->set_rules('fabricCode', 'Fabric Code', 'trim|required|xss_clean'); $this->form_validation->set_rules('fabricType', 'Fabric Type', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/add_product'); $this->load->view('templates/footer_inside'); } else { $idd=$this->session->userdata('logged_in'); $where=array('id'=>$idd); $data['approved_by']=$idd['username']; $d=date('d-m-Y'); $product_data = array( 'type' => $this->input->post('type'), 'fabricCode' => $this->input->post('fabricCode'), 'fabricType' => $this->input->post('fabricType'), 'sides' => $this->input->post('sides'), 'created_by' => $data['approved_by'], 'created_date' => $d ); $productinsert = $this->marketing_model->product_insert($product_data); if ($productinsert == 1) { redirect(base_url() . 'marketing/product_details', 'refresh'); } else { echo "notinserted"; } } } else { $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/add_product'); $this->load->view('templates/footer_inside'); } } public function transactions_order_input() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); if ($this->input->post('submittransaction')) { $this->form_validation->set_rules('oslcategory', 'Osl category', 'trim|required|xss_clean'); $this->form_validation->set_rules('oslNo', 'Osl no', 'trim|required|xss_clean'); //$this->form_validation->set_rules('atozalpha', 'atozalpha', 'trim|required|xss_clean'); $this->form_validation->set_rules('fileNo', 'File no', 'trim|required|xss_clean'); $this->form_validation->set_rules('partyName', 'Party name', 'trim|required|xss_clean'); $this->form_validation->set_rules('modeOfOrder', 'Mode Of Order', 'trim|required|xss_clean'); $this->form_validation->set_rules('partyOrderNo', 'Party OrderNo', 'trim|required|alpha_numeric|xss_clean'); //$this->form_validation->set_rules('partyRef', 'Party Ref', 'trim|required|alpha_numeric|xss_clean'); $this->form_validation->set_rules('orderDate', 'Order Date', 'trim|required|callback_is_start_date_valid|xss_clean'); //$this->form_validation->set_rules('orderRecordDate', 'Order Record Date', 'trim|required|callback_is_start_date_valid|xss_clean'); $this->form_validation->set_rules('deliveryDate', 'Delivery Date', 'trim|required|callback_is_start_date_valid|xss_clean'); //$this->form_validation->set_rules('bankerName', 'Banker Name', 'trim|required|xss_clean'); //$this->form_validation->set_rules('agentName', 'Agent Name', 'trim|required|xss_clean'); //$this->form_validation->set_rules('commision', 'Commision', 'trim|required|xss_clean'); //$this->form_validation->set_rules('validityDate', 'Validity Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('currencyName', 'Currency Name', 'trim|required|xss_clean'); $this->form_validation->set_rules('exrate', 'Exrate', 'trim|required|numeric|xss_clean'); if ($this->form_validation->run() == FALSE) { $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/add_transaction', $data); $this->load->view('templates/footer_inside'); } else { $transaction_data = array('osl_category' => $this->input->post('oslcategory'), 'osl_no' => $this->input->post('oslNo'), 'fileno' => $this->input->post('fileNo'), 'party_name' => $this->input->post('partyName'), 'mode_of_order' => $this->input->post('modeOfOrder'), 'party_order_no' => $this->input->post('partyOrderNo'), //'party_ref' => $this->input->post('partyRef'), 'order_date' => date('Y-m-d', strtotime($this->input->post('orderDate'))), //'order_recd_date' => date('Y-m-d', strtotime($this->input->post('orderRecordDate'))), 'delivery_date' => date('Y-m-d', strtotime($this->input->post('deliveryDate'))), 'banker_name' => $this->input->post('bankerName'), 'agent_name' => $this->input->post('agentName'), 'commission' => $this->input->post('commision'), 'validity_date' => date('Y-m-d', strtotime($this->input->post('validityDate'))), 'currency_name' => $this->input->post('currencyName'), 'ex_rate' => $this->input->post('exrate') ); $qtyinsert = $this->marketing_model->transaction_order_insert($transaction_data); if ($qtyinsert == 1) { redirect(base_url() . 'marketing/transactions_order_details', 'refresh'); } else { echo "notinserted"; } } } else { $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/add_transaction', $data); $this->load->view('templates/footer_inside'); } } //FETCH THE SUBCODE OR SUBORDER DETAILS ACCORDING TO THE SELECTED SUBCODE public function getSubOrderDetails() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $subOrderID = $_REQUEST['subOrderID']; $subOrderDetails = $this->marketing_model->get_sub_order_details($subOrderID); //echo '<pre>';print_r($subOrderDetails);exit; $shades = $this->marketing_model->getShadesOfSubOrder($subOrderID); $subOrderDetails['shades'] = $shades; echo json_encode($subOrderDetails); } public function transactions_order_input_demo($orderID = "") { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); // echo '<pre>'; // print_r($_POST);EXIT; // if(isset($_POST['orderID']) && $_POST['orderID']!= ""){ $orderID = $_POST['orderID']; } if ($orderID != "") { $data['orderDetails'] = $this->marketing_model->get_order_details($orderID); $data['subOrderDetails'] = $this->marketing_model->get_sub_orders($orderID); //echo '<pre>';print_r($data['orderDetails']);exit; $data['orderID'] = $orderID; $subOrderCount = count($data['subOrderDetails']); $data['nextSubCode'] = $subOrderCount + 1; $arrSubCode [0]['subCode'] = 1; $arrSubCode [0]['id'] = ""; $i = 1; foreach ($data['subOrderDetails'] as $subOrder) { $arrSubCode[$i]['subCode'] = $subOrder->subCode; $arrSubCode[$i++]['id'] = $subOrder->id; } $arrSubCode [0] ['subCode'] = $subOrderCount + 1; //echo '<pre>';print_r($arrSubCode);exit; $data['arrSubCode'] = $arrSubCode; } $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $_POST['orderTypes'] = $data['orderTypes']; $data['articles'] = $this->marketing_model->display_article_data(); if ($this->input->post('submitOrder')) { //echo $this->input->post('ourShade')[0]; //echo '<pre>';print_r($_POST);EXIT; $subShadeCount = $this->input->post('subShadeCount'); $data['subShadeCount'] = $subShadeCount; /*if(! isset($_POST['orderTypeOld'] )&& $_POST['orderTypeOld']!=""){ $this->form_validation->set_rules('orderType', 'Order Type', 'required'); }*/ $this->form_validation->set_rules('oslNo', 'Osl no', 'trim|required|xss_clean'); // $this->form_validation->set_rules('atozalpha', 'atozalpha', 'trim|required|xss_clean'); $this->form_validation->set_rules('fileNo', 'File no', 'trim|required|xss_clean'); $this->form_validation->set_rules('partyName', 'Party name', 'trim|required|xss_clean'); //$this->form_validation->set_rules('forcastNo', 'Forcast Number', 'trim|required|xss_clean'); $this->form_validation->set_rules('orderMode', 'Mode Of Order', 'trim|required|xss_clean'); $this->form_validation->set_rules('orderNo', 'Party OrderNo', 'trim|required|alpha_numeric|xss_clean'); //$this->form_validation->set_rules('partyRef', 'Party Ref', 'trim|required|xss_clean'); $this->form_validation->set_rules('orderDate', 'Order Date', 'required|callback_is_start_date_valid|xss_clean'); $this->form_validation->set_rules('delivery', 'Delivery Date', 'required|callback_is_start_date_valid|xss_clean'); $this->form_validation->set_rules('bankerName', 'Banker Name', 'trim|required|xss_clean'); $this->form_validation->set_rules('validityDate', 'Validity Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('currencyName', 'Currency Name', 'trim|required|xss_clean'); $this->form_validation->set_rules('exRate', 'Exrate', 'trim|required|numeric|xss_clean'); //$this->form_validation->set_rules('subCode', 'Sub Code', 'trim|required|xss_clean'); //$this->form_validation->set_rules('person', 'Person', 'trim|required|xss_clean'); $this->form_validation->set_rules('subOrderType', 'Order Type', 'trim|required|xss_clean'); $this->form_validation->set_rules('unit', 'Unit', 'trim|required|xss_clean'); $this->form_validation->set_rules('design', 'Design', 'trim|required|xss_clean'); $this->form_validation->set_rules('width', 'Width', 'trim|required|xss_clean'); $this->form_validation->set_rules('description', 'Description', 'trim|required|xss_clean'); $this->form_validation->set_rules('articleNo', 'Article No', 'trim|required|xss_clean'); $this->form_validation->set_rules('paymentTerms', 'Payment Terms', 'trim|required|xss_clean'); $this->form_validation->set_rules('contractType', 'Contract Type', 'trim|required|xss_clean'); //$this->form_validation->set_rules('second_field', 'Second Field', 'trim|required|is_natural_no_zero|callback_check_equal_less['.$this->input->post('first_field').']'); for($i=1; $i<=$subShadeCount; $i++){ $this->form_validation->set_rules('ourShade['.$i.']', 'Our Shade', 'trim|required|xss_clean'); $ourShade = $this->input->post('ourShade')[$i]; $this->form_validation->set_rules('buyerShade['.$i.']', 'Buyer Shade', 'trim|required|xss_clean'); $this->form_validation->set_rules('quantity['.$i.']', 'Quantity', 'trim|required|xss_clean'); $this->form_validation->set_rules('unitPrice['.$i.']', 'Unit Price', 'trim|required|xss_clean'); $this->form_validation->set_rules('foreignValue['.$i.']', 'Foreign Vlaue', 'trim|required|xss_clean'); //$this->form_validation->set_rules('skuNo['.$i.']', 'SKU No', 'trim|required|xss_clean'); } if ($this->form_validation->run() == FALSE) { $data['outsource'] = $this->request_model->display_product_data(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderID'] = $orderID; $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/add_transaction_demo', $data); $this->load->view('templates/footer_inside'); } else { $post = $_POST; if (isset($_POST['orderConfirmation']) && ($_POST['orderConfirmation'] == 'on')) { $orderConfirm = 'Yes'; } else { $orderConfirm = 'No'; } //echo $subShadeCount;exit; $transaction_data = array( 'oslNo' => $this->input->post('oslNo'), 'orderType' => $this->input->post('orderType'), 'fileNo' => $this->input->post('fileNo'), 'file_type' => $this->input->post('qbweights'), 'forecastNo' => $this->input->post('forecastNo'), 'orderMode' => $this->input->post('orderMode'), 'orderNo' => $this->input->post('orderNo'), 'partyRef' => $this->input->post('partyName'), 'bankername'=>$this->input->post('bankerName'), 'agentname'=>$this->input->post('agentName'), 'commision'=>$this->input->post('commision'), 'preview1'=>'preview', 'preview2'=>'preview', 'preview3'=>'preview', 'orderDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))), 'orderRecDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderRecDate')))), 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('delivery')))), 'orderConfirmDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderConfirmDate')))), 'person' => $this->input->post('person'), // 'bankerName' => $this->input->post('bankerName'), // 'agentName' => $this->input->post('agentName'), // 'commission' => $this->input->post('commision'), 'validityDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('validityDate')))), 'currency' => $this->input->post('currencyName'), 'exRate' => $this->input->post('exRate'), 'paymentTerms' => $this->input->post('paymentTerms'), 'lcNo' => $this->input->post('lcNo'), 'lcDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('lcDate')))), 'expiryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('expiryDate')))), 'daysCredit' => $this->input->post('daysCredit'), 'bank' => $this->input->post('bank'), 'amount' => $this->input->post('amount'), 'customerComments' => $this->input->post('customerComments') ); //echo '<pre>';print_r($transaction_data);exit; $subCodeData = array( 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'orderConfirm' => $orderConfirm, 'orderConfirmDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderConfirmDate')))), 'unit' => $this->input->post('unit'), 'articleNo' => $this->input->post('articleNo'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('design'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'marketingInst' => $this->input->post('marketingInst'), 'unit' => $this->input->post('unit'), //'paymentTerms' => $this->input->post('paymentTerms'), 'contractType' => $this->input->post('contractType'), 'totalQuantity' => $this->input->post('totalQuantity'), 'totalValue' => $this->input->post('totalValue'), 'discount' => $this->input->post('discount'), 'netValue' => $this->input->post('netValue'), 'indianValue' => $this->input->post('indianValue'), 'freightForwarder' => $this->input->post('freightForwarder'), 'freightType' => $this->input->post('freightType'), 'deliveryMode' => $this->input->post('deliveryMode'), 'deliveryPoint' => $this->input->post('deliveryPoint'), 'packingType' => $this->input->post('packingType'), 'labelTerms' => $this->input->post('labelTerms'), 'packingInstructions' => $this->input->post('packingInstructions'), 'inspectionDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('inspectionDate')))), 'agencyAddress' => $this->input->post('agencyAddress') ); $postOrderID = $this->input->post('orderID'); $generateSubCode = $this->input->post('generateSubCode'); if (($postOrderID != "") && ($postOrderID >= 1) && ($generateSubCode == "" || $generateSubCode == "no" )) { //echo '<pre>';print_r($subCodeData); //echo '=>Updation is Working'; $subCodeData['orderID'] = $postOrderID; //echo '<pre>';print_r($_POST);exit; $transaction_data['orderType'] = $this->input->post('orderTypeOld'); $sqlUpdate = $this->marketing_model->updateTransactionOrder($transaction_data, $postOrderID); $subOrderID = $this->input->post('subOrderID'); //echo $subOrderID; if (($subOrderID != "") && ($subOrderID > 0)) { //echo 'sub update';exit; $subCodeData['subCode'] = $_POST['selectedSubCode']; //print_r($subCodeData);exit; $subOrderInsID = $this->marketing_model->updateSubOrder($subCodeData, $subOrderID); } else { $subCodeData['subCode'] = $this->input->post('nextSubCode'); $subOrderID = $this->marketing_model->addSubOrder($subCodeData); } if($subShadeCount == 0) $subShadeCount = 1; if ($subOrderID) { for ($i = 1; $i <= $subShadeCount; $i++) { $currentShadeID = $this->input->post('shadeID')[$i]; $data = array( 'subOrderID' => $subOrderID, 'ourShade' => $this->input->post('ourShade')[$i], 'buyerShade' => $this->input->post('buyerShade')[$i], 'quantity' => $this->input->post('quantity')[$i], 'unitPrice' => $this->input->post('unitPrice')[1], 'foreignValue' => $this->input->post('foreignValue')[$i], 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')[$i]))), 'skuNo' => $this->input->post('skuNo')[$i] ); if ($currentShadeID == "") { $qryIns = $this->marketing_model->addSubOrderShades($data); } else { $qryIns = $this->marketing_model->updateSubOrderShades($data, $currentShadeID); } } } redirect(base_url() . 'marketing/transactions_order_details', 'refresh'); } else { //ADD A NEW ORDER OR GENERATE A SUBORDER FOR THE EXISTING ORDER //echo '=>Second else condition';exit; if ($generateSubCode == 'yes') { $insertOrderID = $this->input->post('orderID'); $subCodeData['subCode'] = $this->input->post('nextSubCode'); $unitPrice = $this->input->post('hiddenUnitPrice'); } else { $insertOrderID = $this->marketing_model->addTransactionOrder($transaction_data); } if ($insertOrderID) { $subCodeData['orderID'] = $insertOrderID; $subOrderInsID = $this->marketing_model->addSubOrder($subCodeData); if ($subOrderInsID) { //echo '<pre>';print_r($_POST); //echo 'subshade count===' . $subShadeCount;//exit; for ($i = 1; $i <= $subShadeCount; $i++) { $data = array( 'subOrderID' => $subOrderInsID, 'ourShade' => $this->input->post('ourShade')[$i], 'buyerShade' => $this->input->post('buyerShade')[$i], 'quantity' => $this->input->post('quantity')[$i], 'unitPrice' => $this->input->post('unitPrice')[1], 'foreignValue' => $this->input->post('foreignValue')[$i], 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')[1]))), 'skuNo' => $this->input->post('skuNo')[$i] ); if ($generateSubCode == 'yes') { $data['unitPrice'] = $unitPrice; } //echo '<pre>';print_r($data);//exit; $qryIns = $this->marketing_model->addSubOrderShades($data); } } //exit; redirect(base_url() . 'marketing/add_order', 'refresh'); } else { echo "notinserted"; } } } } else { //ECHO 'ELSE PART'; $data['outsource'] = $this->request_model->display_product_data(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['url_refrer_val']=$this->input->post('url_reference_val'); $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/add_transaction_demo', $data); $this->load->view('templates/footer_inside'); } } public function getOslDetails() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $orderID = $_REQUEST['orderID']; $oslDetails = $this->marketing_model->get_osl_details($orderID); // print_r($oslDetails); // die(); $data['oslDetails'] = $oslDetails; // print_r($data['oslDetails']); // die(); $this->load->view('marketing/osl_details.php', $data); } public function transactions_order_details() { $this->load->helper('url'); $id = $this->session->userdata('logged_in'); $userId = $id['userid']; $username = $id['username']; $where = array('id' => $userId); $data['emp_details'] = $this->vendor_model->get_customerdata('employee_details', $where); $user_type_id = $data['emp_details']->user_type_id; $uri = $_SERVER["REQUEST_URI"]; $RT = substr($uri, strpos($uri, "/") + 12); if ($RT == 'marketing/transactions_order_details?prop_id=1') { $data['url_val'] = '1'; $data['val'] = 'marketing/transactions_order_details?prop_id=1'; $data['ref'] = 'indent'; } else if ($RT == 'marketing/transactions_order_details?prop_id=2') { $data['url_val'] = '2'; $data['val'] = 'marketing/transactions_order_details?prop_id=1'; $data['ref'] = 'today_dashboard'; } else if ($RT == 'marketing/transactions_order_details?prop_id=3') { $data['url_val'] = '3'; $data['val'] = 'marketing/transactions_order_details?prop_id=1'; $data['ref'] = 'month_dashboard'; } else if ($RT == 'marketing/transactions_order_details?prop_id=4') { $data['url_val'] = '4'; $data['val'] = 'marketing/transactions_order_details?prop_id=1'; $data['ref'] = 'year_dashboard'; } $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; $data['access'] = $this->access_details(); $access_menu_id = $this->access_details_id(); $menu_ids = unserialize($access_menu_id->menu_id); $check = ""; foreach ($menu_ids as $menu_id) { $where = array('delete_status' => 'ACTIVE', 'menu_id' => $menu_id); $result = $this->marketing_model->fetch_main_data('swansilk_menu', $where); if (!empty($result->reference_url) && $result->reference_url == $data['val']) { $check = $data['val']; } } if ($check != "") { foreach ($menu_ids as $menu_id) { $where = array('menu_id' => $menu_id, 'department_id' => $user_type_id); $arr = $this->vendor_model->get_where_row('access_action_rights', $where); if (!empty($arr)) { $menu_id = $arr->menu_id; $where = array('menu_id' => $menu_id); $url = $this->vendor_model->get_where_row('swansilk_menu', $where); if (!empty($url->reference_url) && $url->reference_url == $data['val']) { $data['access_row'] = $arr; } } } $data['getalldata'] = $this->marketing_model->display_transaction_data(); $data['user_list'] = $this->vendor_model->fetch_where_data('employee_details'); $data['approved_by'] = $username; $where = array('unread' => '0', 'to_id' => $userId); $data['chatting_count'] = $this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata('chat_message', $where); $this->load->view('templates/header_inside', $data); $this->load->view('marketing/transaction_mstr_details', $data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function add_order() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['max']=$this->marketing_model->fetch_max_id_orders(); $m=$data['max']->id; $where=array('orderID'=>$m); $data['max_sub_order']=$this->marketing_model->fetch_edit_data($where); $sub_code=$data['max_sub_order']->subCode; $data['sub_code_increment']=$sub_code+1; $d = $data['max']->orderDate ; // Pull your date from the db $date = new DateTime($d); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $delivery_date = $data['max']->deliveryDate ; // Pull your date from the db $date = new DateTime($delivery_date); $data['deliver_day'] = $date->format('d') ; // Creates date number $data['deliver_month'] = $date->format('m'); // Creates month number $data['deliver_year'] = $date->format('Y'); $validityDate = $data['max']->validityDate ; // Pull your date from the db $date = new DateTime($validityDate); $data['validityDate_day'] = $date->format('d') ; // Creates date number $data['validityDate_month'] = $date->format('m'); // Creates month number $data['validityDate_year'] = $date->format('Y'); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/add_transaction_demo', $data); $this->load->view('templates/footer_inside'); } public function getorder_details() { $get = $this->uri->segment(3); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $getalldata1 = $this->marketing_model->getorder(); foreach($getalldata1 as $v) { $orderID=$v->id; $status=0; $details=$this->marketing_model->get_shadeNo_status($orderID, $status); if(empty($details)) { $data=array('confirm_status' => 'CONFIRMED'); $where=array('id' => $orderID); $table = 'orders'; $this->marketing_model->update_data($where,$table,$data); } else { $data=array('confirm_status' => 'PENDING'); $where=array('id' => $orderID); $table = 'orders'; $this->marketing_model->update_data($where,$table,$data); } } $m=date('m'); $y=date('Y'); if($get == 'stoday_dashboard') { $m=date('m'); $y=date('Y'); $d1=date('d-m-Y'); $table='sub_orders'; $where=array('created_date'=>$d1); $dd='DTL'; $getalldata=$this->vendor_model->marketing_res_dashboard_po_list_id($d1,$dd); } else if($get == 'sindent') { $getalldata = $this->marketing_model->OSL_NUMBERss_getorder(); } else if($get == 'smonth_dashboard') { $m=date('m'); $y=date('Y'); $d1=date('d-m-Y'); $table='sub_orders'; $where=array('created_date'=>$d1); $dd='DTL'; $getalldata=$this->vendor_model->monthly_marketing_res_dashboard_po_list_id($table,$m,$y,$dd); } else if($get == 'syear_dashboard') { $m=date('m'); $y=date('Y'); $d1=date('d-m-Y'); $table='sub_orders'; $where=array('created_date'=>$d1); $dd='DTL'; $getalldata=$this->vendor_model->year_marketing_res_dashboard_po_list_id($table,$y,$dd); } echo json_encode($getalldata); } public function subgrid1() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $get = $this->uri->segment(3); preg_match_all('!\d+!', $get, $matches); $id=""; foreach($matches as $matches) { $id=$matches; } $i= $id[0]; $getalldata = $this->marketing_model->getsuborder_update($i); //$getalldata = $this->marketing_model->input_preview_input_suborder($i); //print_r($getalldata); echo json_encode($getalldata); } public function pending_subgrid1() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $get = $this->uri->segment(3); preg_match_all('!\d+!', $get, $matches); $id=""; foreach($matches as $matches) { $id=$matches; } $i= $id[0]; $getalldata = $this->marketing_model->pending_getsuborder_update($i); //$getalldata = $this->marketing_model->input_preview_input_suborder($i); //print_r($getalldata); echo json_encode($getalldata); } public function completed_subgrid1() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $get = $this->uri->segment(3); preg_match_all('!\d+!', $get, $matches); $id=""; foreach($matches as $matches) { $id=$matches; } $i= $id[0]; $getalldata = $this->marketing_model->completed_getsuborder_update($i); //$getalldata = $this->marketing_model->input_preview_input_suborder($i); //print_r($getalldata); echo json_encode($getalldata); } public function subgrid() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $get = $this->uri->segment(3); preg_match_all('!\d+!', $get, $matches); $id=""; foreach($matches as $matches) { $id=$matches; } $i= $id[0]; //$getalldata = $this->marketing_model->getsuborder_update($i); $getalldata = $this->marketing_model->getsuborder($i); //$getalldata = $this->marketing_model->input_preview_input_suborder($i); //print_r($getalldata); //die(); echo json_encode($getalldata); } //get customer name based on file number_format// to be changed public function getcust_name() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $filenor = $_REQUEST['filenor']; $getcustname = $this->marketing_model->display_name($filenor); foreach ($getcustname as $getresult) { echo $getresult->customerName . '--' . $getresult->bankerName . '--' . $getresult->agentName . '--' . $getresult->agentCommission . '--' . $getresult->agencyFromDate; } } public function getCustomerData() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $fileNumber = $_REQUEST['fileNo']; $custData = $this->marketing_model->getCustomerData($fileNumber); echo json_encode($custData); } public function getCustomerProduct() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $fileNumber = $_REQUEST['fileNo']; $fileNumber = $_REQUEST['fileNo']; $custData = $this->marketing_model->getCustomerData($fileNumber); $productdata = $this->marketing_model->getCustomerProduct($custData->customerID); // print_r($this->db->last_query()); echo json_encode($productdata); } public function getProductDetails() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $product_id = $_REQUEST['product_id']; $ProData = $this->marketing_model->getProductDetails($product_id); echo json_encode($ProData); } //generate osl number in transaction master // to be removed public function create_oslnor() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $oslvalue = $_REQUEST['oslcat']; $query = $this->db->query('SELECT * FROM transaction_order'); $invoiceno = $query->num_rows() + 1; $invID = str_pad($invoiceno, 1, '0', STR_PAD_LEFT); $month = date("m"); if ($month == "01" || $month == "02" || $month == "03") { $yearis = date("Y") - 1; } else { $yearis = date("Y"); } echo $yearis . $oslvalue . $invID; } //GENERATE THE OSL NUNBER AND FETCH OR GENERATE THE SUBCODE //display file number based on the selection from A to Z alpha in transaction master public function disp_alpha_filenos() { ?> <option value="">Select</option> <?php $alphachar = $_REQUEST['alphachar']; $getcustname = $this->marketing_model->filter_customer_filenor($alphachar); foreach ($getcustname as $filter_file) { ?> <option <?php echo set_select('fileNo', $filter_file->customerID); ?> value="<?php echo $filter_file->customerID; ?>"><?php echo $filter_file->customerID; ?></option> <?php } } //date validation with format of dd/mm/yy : 05/03/2015 function is_start_date_valid($date) { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $date_regex = '^\d{2}/\d{2}/\d{4}^'; if (!(is_array($date)) && (!preg_match($date_regex, $date))) { $this->form_validation->set_message('is_start_date_valid', 'Please enter date format : dd/mm/yy'); return false; } else { return true; } } //TO GET THE DESIGN AND QUALITY OF A SELECTED ARTICLE NUMBER public function getDesignAndQuality() { $db_conn = mysqli_connect("localhost", "decotextil", "Deco1236", "decotextil_new"); // Evaluate the connection if (mysqli_connect_errno()) { echo mysqli_connect_error(); exit(); } else { //echo "Successful database connection, happy coding!!!"; } //die(); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $articleNo = $_REQUEST['articleNo']; $data['arrArticleDet'] = $this->marketing_model->getArticleDetails($articleNo); $where=array('articleNo'=>$articleNo); $detail=$this->marketing_model->select_article_row($where); $id=$detail->articleID; $data['composition']=$this->planning_shade->total_composition($id); $r="SELECT * FROM warping_wearing"; $getwarpingwearing=mysqli_query($db_conn,$r); //$getwarpingwearing=mysqli_query($r); $wwresult=mysqli_fetch_array($getwarpingwearing); $warpingfinal=$wwresult[1]; $wearingfinal=$wwresult[2]; $getarticledata=$this->planning_shade->display_article_all(); $getwarp=$this->planning_shade->display_warp_all(); $getweft=$this->planning_shade->display_weft_all(); $finalWarping=0; $finalWearing=0; foreach($getarticledata as $fresults) { if($fresults->articleID==$id) { $finalWarping=$fresults->warpTotalEnds*$warpingfinal; $finalWearing= $fresults->weftPicks*$wearingfinal; } } $warprates=0; foreach($getwarp as $warprate) { if($id == $warprate->article_id) { $query=mysqli_query($db_conn,"SELECT * FROM import_yarn where yarnName='".$warprate->Warp_Quality."' and yarnDenier='".$warprate->Warp_Denier."' and yarnSpecification='".$warprate->Warp_Specification."' and yarnType='Warp'"); while($results=mysqli_fetch_array($query)) { $warprates=$warprates+$results['rate']*$warprate->Kora_Wt; } } } $weftrates=0; foreach($getweft as $weftrate) { if($id == $weftrate->article_id) { $query1=mysqli_query($db_conn,"SELECT * FROM import_yarn where yarnName='".$weftrate->Weft_Quality."' and yarnDenier='".$weftrate->Weft_Denier."' and yarnSpecification='".$weftrate->Weft_Specification."' and yarnType='Weft'"); while($results1=mysqli_fetch_array($query1)) { $weftrates=$weftrates+$results1['rate']*$weftrate->Kora_Wt; } } } $totalwarpweftratess=$warprates+$weftrates; $data['totalwarpweftrates']=$totalwarpweftratess+$finalWarping+$finalWearing; //consol.log($id); echo json_encode($data); } public function oslno(){ $this->db->select('oslNo'); $this->db->from('orders'); $this->db->group_by(oslNo); $query=$this->db->get(); return $query->result(); } public function getproducts() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $articleNo = $_REQUEST['articleNo']; //$data['arrArticleDet'] = $this->marketing_model->getArticleDetails($articleNo); $where=array('product'=>$articleNo,'product_type'=>'Fabrics'); $data['arrArticleDet']=$this->marketing_model->select_product_row($where); $data['outsource'] = $this->request_model->display_product_data(); echo json_encode($data); } public function getproducts_category() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $product_category = $_REQUEST['product_category']; $where=array('id'=>$product_category); $data['p_details']=$this->marketing_model->select_product_row1($where); // print_r($this->db->last_query()); // die(); echo json_encode($data); } //check when type and fabric type combination is unique or not function uniq_producttype() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $type = $this->input->post('type'); $fabricType = $this->input->post('fabricType'); $result = $this->marketing_model->uniqueproduct($type, $fabricType); if (!$result) { return true; } else { $this->form_validation->set_message('uniq_producttype', 'Type and Fabric Type already Exist.'); return false; } } function check_equal_ourShade($second_field,$first_field) { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); if ($second_field == $first_field) { $this->form_validation->set_message('check_equal_ourShade', 'Our shade and Buyer shade are equal'); return false; } else {return true;} } public function getProductType() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $fabricType=$_REQUEST['fabricType'];$type = $this->marketing_model->displayProductType($fabricType); echo $type;} public function subcodesdisplay() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $orderID=$this->input->post('id'); $suborders=$this->marketing_model->displayorderinputdata($orderID); echo json_encode($suborders); } public function performanceinvoicedata() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $orderID=$this->input->post('id'); $suborders=$this->marketing_model->performanceinvoicedata($orderID); echo json_encode($suborders); } public function orederconfirmation() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $preview_date=($data['fetch_preview1']->orderDate); $date = new DateTime($preview_date); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $data['fetch_preview2']=$this->marketing_model->order_preview($preview1); $table1='sub_orders'; $where1=array('orderID'=>$preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table1,$where1); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='indent_preview'; $this->load->view('marketing/transaction_order_confirmation_preview',$data); } public function order_confirm_preview() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $preview_date=($data['fetch_preview1']->orderDate); $date = new DateTime($preview_date); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $data['fetch_preview2']=$this->marketing_model->order_preview($preview1); $table1='sub_orders'; $where1=array('orderID'=>$preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table1,$where1); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='today_preview'; $this->load->view('marketing/transaction_order_confirmation_preview',$data); } public function order_confirmation_preview() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $preview_date=($data['fetch_preview1']->orderDate); $date = new DateTime($preview_date); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $data['fetch_preview2']=$this->marketing_model->order_preview($preview1); $table1='sub_orders'; $where1=array('orderID'=>$preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table1,$where1); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='monthly_preview'; $this->load->view('marketing/transaction_order_confirmation_preview',$data); } public function order_confirm() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $preview_date=($data['fetch_preview1']->orderDate); $date = new DateTime($preview_date); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $data['fetch_preview2']=$this->marketing_model->order_preview($preview1); $table1='sub_orders'; $where1=array('orderID'=>$preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table1,$where1); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='year_preview'; $this->load->view('marketing/transaction_order_confirmation_preview',$data); } public function preview(){ $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table1='sub_orders'; $where1=array('orderID'=>$preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table1,$where1); $data['fetch_preview2']=$this->marketing_model->order_preview($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $invoice_no=$data['fetch_preview1']->invoice_no; $oslno=$data['fetch_preview1']->oslNo; $b=$this->marketing_model->fetch_main(); $where=array('oslNo'=>$oslno); $table='orders'; $data['aa']=$this->marketing_model->fetch_where_data_edit($table,$where); $data['indent_p']='indent_preview'; if($data['aa']->invoice_no>0) { $data['invoice']= $data['aa']->invoice_no; $this->load->view('marketing/transaction_mstr_details_preview',$data); } else { $m = $b->invoice_value; $mmm=$m+1; $where=array('oslNo'=>$oslno); $year=date('Y'); $y = substr( $year, -2); $p='PI'; $data['invoice']=$y.'/'.$p.'/'.$mmm; $d=array('invoice_value'=>$mmm,'invoice_no'=>$data['invoice']); $this->marketing_model->update($d,$where); $where=array('oslNo'=>$oslno); $table='orders'; $data['bb']=$this->marketing_model->fetch_where_data_edit($table,$where); $this->load->view('marketing/transaction_mstr_details_preview',$data); } } public function performa_invoice_preview(){ $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table1='sub_orders'; $where1=array('orderID'=>$preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table1,$where1); $data['fetch_preview2']=$this->marketing_model->order_preview($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $invoice_no=$data['fetch_preview1']->invoice_no; $oslno=$data['fetch_preview1']->oslNo; $b=$this->marketing_model->fetch_main(); $where=array('oslNo'=>$oslno); $table='orders'; $data['aa']=$this->marketing_model->fetch_where_data_edit($table,$where); $data['indent_p']='today_preview'; if($data['aa']->invoice_no>0) { $data['invoice']= $data['aa']->invoice_no; $this->load->view('marketing/transaction_mstr_details_preview',$data); } else { $m = $b->invoice_value; $mmm=$m+1; $where=array('oslNo'=>$oslno); $year=date('Y'); $y = substr( $year, -2); $p='PI'; $data['invoice']=$y.'/'.$p.'/'.$mmm; $d=array('invoice_value'=>$mmm,'invoice_no'=>$data['invoice']); $this->marketing_model->update($d,$where); $where=array('oslNo'=>$oslno); $table='orders'; $data['bb']=$this->marketing_model->fetch_where_data_edit($table,$where); $this->load->view('marketing/transaction_mstr_details_preview',$data); } } public function performa_invoice(){ $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table1='sub_orders'; $where1=array('orderID'=>$preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table1,$where1); $data['fetch_preview2']=$this->marketing_model->order_preview($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $invoice_no=$data['fetch_preview1']->invoice_no; $oslno=$data['fetch_preview1']->oslNo; $b=$this->marketing_model->fetch_main(); $where=array('oslNo'=>$oslno); $table='orders'; $data['aa']=$this->marketing_model->fetch_where_data_edit($table,$where); $data['indent_p']='monthly_preview'; if($data['aa']->invoice_no>0) { $data['invoice']= $data['aa']->invoice_no; $this->load->view('marketing/transaction_mstr_details_preview',$data); } else { $m = $b->invoice_value; $mmm=$m+1; $where=array('oslNo'=>$oslno); $year=date('Y'); $y = substr( $year, -2); $p='PI'; $data['invoice']=$y.'/'.$p.'/'.$mmm; $d=array('invoice_value'=>$mmm,'invoice_no'=>$data['invoice']); $this->marketing_model->update($d,$where); $where=array('oslNo'=>$oslno); $table='orders'; $data['bb']=$this->marketing_model->fetch_where_data_edit($table,$where); $this->load->view('marketing/transaction_mstr_details_preview',$data); } } public function performa_invoice_view(){ $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table1='sub_orders'; $where1=array('orderID'=>$preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table1,$where1); $data['fetch_preview2']=$this->marketing_model->order_preview($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $invoice_no=$data['fetch_preview1']->invoice_no; $oslno=$data['fetch_preview1']->oslNo; $b=$this->marketing_model->fetch_main(); $where=array('oslNo'=>$oslno); $table='orders'; $data['aa']=$this->marketing_model->fetch_where_data_edit($table,$where); $data['indent_p']='year_preview'; if($data['aa']->invoice_no>0) { $data['invoice']= $data['aa']->invoice_no; $this->load->view('marketing/transaction_mstr_details_preview',$data); } else { $m = $b->invoice_value; $mmm=$m+1; $where=array('oslNo'=>$oslno); $year=date('Y'); $y = substr( $year, -2); $p='PI'; $data['invoice']=$y.'/'.$p.'/'.$mmm; $d=array('invoice_value'=>$mmm,'invoice_no'=>$data['invoice']); $this->marketing_model->update($d,$where); $where=array('oslNo'=>$oslno); $table='orders'; $data['bb']=$this->marketing_model->fetch_where_data_edit($table,$where); $this->load->view('marketing/transaction_mstr_details_preview',$data); } } public function orderinput() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table='sub_orders'; $where=array('orderID'=>$preview1); $data['fetch_preview2']=$this->marketing_model->input_preview_input_suborder($preview1); $data['fetch_preview_unit']=$this->marketing_model->input_preview_input_suborder($preview1); //$data['fetch_preview21']=$this->marketing_model->input_preview_input_suborder($preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table,$where); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='indent_preview'; $this->load->view('marketing/transaction_order_input_preview',$data); } public function recent_shipment() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1 = ($data['fetch_preview1']->id); $table5 ='sub_orders'; $where5 = array('orderID'=>$preview1); $data['sub_orders'] = $this->marketing_model->fetch_main_data($table5,$where5); $data['fileNo'] = $data['fetch_preview1']->fileNo; $data['orders_Type'] = $data['sub_orders']->orders_Type; $data['orders_id'] = $val; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $RT = substr($uri, strpos($uri, "/") + 12); // print_r( $data['orders_Type']); // die(); // $RT = 'stock_history/fabric_billing'; // if($RT == 'marketing/recent_shippment/?id=$val') // { // $data['url_val']='1'; // $data['val']='marketing/recent_shippment'; // $data['ref']='indent'; // } // else if($RT == 'marketing/recent_shippment?prop_id=2') // { // $data['val']='marketing/recent_shippment?prop_id=1'; // $data['url_val']='2'; // $data['ref']='today_dashboard'; // } // else if($RT == 'marketing/recent_shippment?prop_id=3') // { // $data['url_val']='3'; // $data['val']='marketing/recent_shippment?prop_id=1'; // $data['ref']='month_dashboard'; // } // else if($RT == 'marketing/recent_shippment?prop_id=4') // { // $data['url_val']='4'; // $data['val']='marketing/recent_shippment?prop_id=1'; // $data['ref']='year_dashboard'; // } // $id=$this->session->userdata('logged_in'); // $where=array('id'=>$id); // $data['approved_by']=$id['username']; // //<!----add from-------------> // $id=$this->session->userdata('logged_in'); // $where=array('id'=>$id); // $approved_id=$id['userid']; // $table='employee_details'; // $where=array('id'=>$approved_id); // $dept_id_row=$this->vendor_model->get_where_row($table,$where); // $user_type_id_row=$dept_id_row->user_type_id; // //----------tiill-------------------- $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); // $m_id=unserialize($access_menu_id->menu_id); // $check=""; // foreach($m_id as $menu_id) // { // $table='swansilk_menu'; // $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); // $result= $this->marketing_model->fetch_main_data($table,$where); // if(!empty($result->reference_url)){ // if($result->reference_url == $data['val']) // { // $check='stock_history/fabric_billing'; // } // } // } // if($check != "") // { // //<!----add from -------------> // $access_menu_id=$this->access_details_id(); // $m_id=unserialize($access_menu_id->menu_id); // $data1=array(); // foreach($m_id as $menu_id) // { // $table='access_action_rights'; // $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); // $arr=$this->vendor_model->get_where_row($table,$where); // //print_r($arr); // if(empty($arr)) // { // } // else // { //print_r($arr); // $menu_id=$arr->menu_id; // $table='swansilk_menu'; // $where=array('menu_id'=>$menu_id); // $url=$this->vendor_model->get_where_row($table,$where); // if(!empty($url->reference_url)){ // if($url->reference_url == $data['val']) // { // $data['access_row']=$arr; // } // } // } // } //die(); //----------tiill-------------------- // $data['userdetails'] = $this->session_data_pass(); // $data['user_type_id'] = $this->access_id(); // $data['access'] = $this->access_details(); // $table='employee_details'; // $data['user_list']=$this->vendor_model->fetch_where_data($table); // $id=$this->session->userdata('logged_in'); // $where=array('id'=>$id); // $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); // $table='packing_list_data'; // $where=array('customerID'=>''); // $data_custom_ids=$this->vendor_model->get_data($table,$where); // if(empty($data_custom_ids)) // { // } // else // { // foreach($data_custom_ids as $c) // { // $where=array('customerName'=>$c->customer_name); // $table='customer_master'; // $custom_ids=$this->vendor_model->get_customerdata($table,$where); // if(empty($custom_ids)) // { // } // else // { // $table='packing_list_data'; // $where=array('id'=>$c->id); // $cus_data=array('customerID'=>$custom_ids->customerID); // $this->vendor_model->update_data($where,$table,$cus_data); // } // } // } // } $this->load->view('templates/header_inside',$data); // print_r($data['sub_orders']->orders_Type); // die(); if($data['sub_orders']->orders_Type == 'Fabric' || $data['sub_orders']->orders_Type == 'FABRIC'){ $this->load->view('marketing/recent_shipment',$data); } else if($data['sub_orders']->orders_Type == 'Madeups' || $data['sub_orders']->orders_Type == 'MADEUPS'){ $this->load->view('marketing/recent_shipment_madeups',$data); } $this->load->view('templates/footer_inside'); //print_r( $data); // die(); } public function orderinput_preview() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table='sub_orders'; $where=array('orderID'=>$preview1); $data['fetch_preview2']=$this->marketing_model->input_preview_input_suborder($preview1); $data['fetch_preview_unit']=$this->marketing_model->input_preview_input_suborder($preview1); //$data['fetch_preview21']=$this->marketing_model->input_preview_input_suborder($preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table,$where); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='today_preview'; $this->load->view('marketing/transaction_order_input_preview',$data); } public function order_input() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table='sub_orders'; $where=array('orderID'=>$preview1); $data['fetch_preview2']=$this->marketing_model->input_preview_input_suborder($preview1); $data['fetch_preview_unit']=$this->marketing_model->input_preview_input_suborder($preview1); //$data['fetch_preview21']=$this->marketing_model->input_preview_input_suborder($preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table,$where); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='monthly_preview'; $this->load->view('marketing/transaction_order_input_preview',$data); } public function order_input_preview() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table='sub_orders'; $where=array('orderID'=>$preview1); $data['fetch_preview2']=$this->marketing_model->input_preview_input_suborder($preview1); $data['fetch_preview_unit']=$this->marketing_model->input_preview_input_suborder($preview1); //$data['fetch_preview21']=$this->marketing_model->input_preview_input_suborder($preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table,$where); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='year_preview'; $this->load->view('marketing/transaction_order_input_preview',$data); } public function customer_update() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->input->post("id"); $oslNo=$this->input->post("oslNo"); $fileNo=$this->input->post("fileNo"); $oredrMode=$this->input->post("orderMode"); $orderNo=$this->input->post("orderNo"); $where=array('id'=>$id); $data=array('id'=>$id,'oslNo'=>$oslNo,'fileNo'=>$fileNo,'orderMode'=>$oredrMode,'orderNo'=>$orderNo ); $details = $this->marketing_model->update($data,$where); return true; } public function customer_delete() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->input->post('id'); $where=array('id'=>$id); $status=array('status'=>1); $this->marketing_model->update($status,$where); return true; } public function add_confirmation() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $dy=date('d-m-Y'); $id=$this->input->post("id"); $where=array('id'=>$id); $data=array('orderConfirm'=>'Yes','confirm_by'=>$approved_by,'orderConfirmDate'=>$dy); $details = $this->marketing_model->update_new($data,$where); $where=array('id'=>$id); $details_id = $this->marketing_model->fetch_edit_data($where); $order_id=$details_id->orderID; $table='orders'; $where=array('id'=>$order_id); $details_order_id = $this->marketing_model->fetch_where_data_edit($table,$where); $date_raw=$details_order_id->deliveryDate; $before_20= date('Y-m-d', strtotime('-20 day', strtotime($date_raw))); $before_15= date('Y-m-d', strtotime('-15 day', strtotime($date_raw))); $before_2= date('Y-m-d', strtotime('-2 day', strtotime($date_raw))); $current_date=date('Y-m-d'); $confirm_by=$approved_by; $osl_num=$details_order_id->oslNo; $o_date=$details_order_id->orderDate; $d_date=$details_order_id->deliveryDate; if($before_20 == $current_date) { $this->load->library('email'); $this->email->set_mailtype('html'); $msgs = "Hello, The OSL No."." ".$osl_num." "."has been confirmed by ".$confirm_by." "."Order Date is ".$o_date." " ."and Delivery Date is ".$d_date; $this->email->set_newline("\r\n"); $list = array('management@swansilk.com', 'usha@swansilk.com','mani@swansilk.com'); $this->email->from('info@deco-textil.com'); $this->email->to($list); $this->email->subject('Confirmed New Order'); $data['message'] = $msgs; $this->email->message($msgs); $this->email->send(); } else if($before_15 == $current_date) { $this->load->library('email'); $this->email->set_mailtype('html'); $msgs = "Hello, The OSL No."." ".$osl_num." "."has been confirmed by ".$confirm_by." "."Order Date is ".$o_date." " ."Delivery Date is ".$d_date; $this->email->set_newline("\r\n"); $list = array('management@swansilk.com', 'usha@swansilk.com','mani@swansilk.com'); $this->email->from('info@deco-textil.com'); $this->email->to($list); $this->email->subject('Confirmed New Order'); $data['message'] = $msgs; $this->email->message($msgs); $this->email->send(); } else if($before_2 == $current_date) { $this->load->library('email'); $this->email->set_mailtype('html'); $msgs = "Hello, The OSL No."." ".$osl_num." "."has been confirmed by ".$confirm_by." "."Order Date is ".$o_date." " ."Delivery Date is ".$d_date; $this->email->set_newline("\r\n"); $list = array('management@swansilk.com', 'usha@swansilk.com','mani@swansilk.com'); $this->email->from('info@deco-textil.com'); $this->email->to($list); $this->email->subject('Confirmed New Order'); $data['message'] = $msgs; $this->email->message($msgs); $this->email->send(); } return true; } public function add() { $id=$this->input->post("id"); $where=array('id'=>$id); $data=array('orderConfirm'=>'No'); $details = $this->marketing_model->update_new($data,$where); return true; } public function get_file_nos() { $id=$this->session->userdata('logged_in'); $file_type=$this->input->post('f_type'); $table='orders'; $where=array('file_type'=>$file_type); $f_types=$this->marketing_model->fetch_where_data_edit1($table,$where); if($f_types) { echo json_encode(array("result"=>1,'message'=>$f_types)); }else { echo json_encode(array("result"=>0,'message'=>"No Data Found")); } } public function edit_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "=") + 1); $table='sub_orders'; //$data['generated_value']=array('id'=>$val); $where=array('id'=>$data['val'] ); $data['edit_data1']=$this->marketing_model->fetch_where_data_edit($table,$where); $w=$data['edit_data1']->orderID; //print_r($this->db->last_query()); //print_r($data['edit_data1']); //die(); $table='orders'; $where=array('id'=>$w); $data['edit_data2']=$this->marketing_model->fetch_where_data_edit($table,$where); $group_by=array('file_type'); $data['file_types_new']=$this->marketing_model->fetch_where_group_data_all($table,$group_by); $data['file_types_new1']=$this->marketing_model->fetch_where_data_all($table); $d = $data['edit_data2']->orderDate ; // Pull your date from the db $date = new DateTime($d); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $dd = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($dd); $data['deliveryDate_day'] = $date->format('d') ; // Creates date number $data['deliveryDate_month'] = $date->format('m'); // Creates month number $data['deliveryDate_year'] = $date->format('Y'); $lc_date = $data['edit_data2']->lcDate ; // Pull your date from the db $date = new DateTime($lc_date); $data['lc_day'] = $date->format('d') ; // Creates date number $data['lc_month'] = $date->format('m'); // Creates month number $data['lc_year'] = $date->format('Y'); $deliver_date = $data['edit_data2']->expiryDate ; // Pull your date from the db $date = new DateTime($deliver_date); $data['expiry_day'] = $date->format('d') ; // Creates date number $data['expiry_month'] = $date->format('m'); // Creates month number $data['expiry_year'] = $date->format('Y'); $delivery_date = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($delivery_date); $data['deliver_day'] = $date->format('d') ; // Creates date number $data['deliver_month'] = $date->format('m'); // Creates month number $data['deliver_year'] = $date->format('Y'); $validityDate = $data['edit_data2']->validityDate ; // Pull your date from the db $date = new DateTime($validityDate); $data['validityDate_day'] = $date->format('d') ; // Creates date number $data['validityDate_month'] = $date->format('m'); // Creates month number $data['validityDate_year'] = $date->format('Y'); //validityDate $table='sub_order_shades'; $where=array('subOrderID'=>$data['val'] ); $data['edit_data3']=$this->marketing_model->fetch_where_data_edit1($table,$where); // $val=$data['edit_data3']->subOrderID; // $where_con=array('subOrderID'=>$data['val']); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where); $res3=$this->marketing_model->fetch_edit_data_update5($where); $ress=$res3->foreignValue; $where1=$data['edit_data2']->exRate; $data['res4']= $ress * $where1; // print_r($data['res4']); // die(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); //$data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['shadeNo'] = $this->marketing_model->get_shadeNo2($w,'0'); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['indent_p']='indent_preview'; // echo $data['edit_data1']->insert_type; // die(); if($data['edit_data1']->insert_type == 'CUSTOMER'){ $oslvalue = substr($uri, strpos($uri, "=") + 1); $newOSL = $this->marketing_model->generateOSL($oslvalue); $data['osl']=$newOSL['osl']; $data['sub']=$newOSL['sub']; $data['subcode']=1; $data['shade'] = $this->marketing_model->getshade($data['edit_data1']->product_id); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/update_on_customer', $data); $this->load->view('templates/footer_inside'); } else{ $this->load->view('templates/header_inside',$data); $this->load->view('marketing/update', $data); $this->load->view('templates/footer_inside'); } } public function edit_marketing_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "=") + 1); $table='sub_orders'; //$data['generated_value']=array('id'=>$val); $where=array('id'=>$data['val'] ); $data['edit_data1']=$this->marketing_model->fetch_where_data_edit($table,$where); $w=$data['edit_data1']->orderID; //print_r($data['edit_data1']); //die(); $table='orders'; $where=array('id'=>$w); $data['edit_data2']=$this->marketing_model->fetch_where_data_edit($table,$where); $d = $data['edit_data2']->orderDate ; // Pull your date from the db $date = new DateTime($d); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $dd = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($dd); $data['deliveryDate_day'] = $date->format('d') ; // Creates date number $data['deliveryDate_month'] = $date->format('m'); // Creates month number $data['deliveryDate_year'] = $date->format('Y'); $lc_date = $data['edit_data2']->lcDate ; // Pull your date from the db $date = new DateTime($lc_date); $data['lc_day'] = $date->format('d') ; // Creates date number $data['lc_month'] = $date->format('m'); // Creates month number $data['lc_year'] = $date->format('Y'); $deliver_date = $data['edit_data2']->expiryDate ; // Pull your date from the db $date = new DateTime($deliver_date); $data['expiry_day'] = $date->format('d') ; // Creates date number $data['expiry_month'] = $date->format('m'); // Creates month number $data['expiry_year'] = $date->format('Y'); $delivery_date = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($delivery_date); $data['deliver_day'] = $date->format('d') ; // Creates date number $data['deliver_month'] = $date->format('m'); // Creates month number $data['deliver_year'] = $date->format('Y'); $validityDate = $data['edit_data2']->validityDate ; // Pull your date from the db $date = new DateTime($validityDate); $data['validityDate_day'] = $date->format('d') ; // Creates date number $data['validityDate_month'] = $date->format('m'); // Creates month number $data['validityDate_year'] = $date->format('Y'); //validityDate $table='sub_order_shades'; $where=array('subOrderID'=>$data['val'] ); $data['edit_data3']=$this->marketing_model->fetch_where_data_edit1($table,$where); // $val=$data['edit_data3']->subOrderID; // $where_con=array('subOrderID'=>$data['val']); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where); $res3=$this->marketing_model->fetch_edit_data_update5($where); $ress=$res3->foreignValue; $where1=$data['edit_data2']->exRate; $data['res4']= $ress * $where1; // print_r($data['res4']); // die(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); //$data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['shadeNo'] = $this->marketing_model->get_shadeNo2($w,'0'); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['indent_p']='today_preview'; $this->load->view('templates/header_inside',$data); $this->load->view('marketing/update', $data); $this->load->view('templates/footer_inside'); } public function edit_transaction_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "=") + 1); $table='sub_orders'; //$data['generated_value']=array('id'=>$val); $where=array('id'=>$data['val'] ); $data['edit_data1']=$this->marketing_model->fetch_where_data_edit($table,$where); $w=$data['edit_data1']->orderID; //print_r($data['edit_data1']); //die(); $table='orders'; $where=array('id'=>$w); $data['edit_data2']=$this->marketing_model->fetch_where_data_edit($table,$where); $d = $data['edit_data2']->orderDate ; // Pull your date from the db $date = new DateTime($d); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $dd = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($dd); $data['deliveryDate_day'] = $date->format('d') ; // Creates date number $data['deliveryDate_month'] = $date->format('m'); // Creates month number $data['deliveryDate_year'] = $date->format('Y'); $lc_date = $data['edit_data2']->lcDate ; // Pull your date from the db $date = new DateTime($lc_date); $data['lc_day'] = $date->format('d') ; // Creates date number $data['lc_month'] = $date->format('m'); // Creates month number $data['lc_year'] = $date->format('Y'); $deliver_date = $data['edit_data2']->expiryDate ; // Pull your date from the db $date = new DateTime($deliver_date); $data['expiry_day'] = $date->format('d') ; // Creates date number $data['expiry_month'] = $date->format('m'); // Creates month number $data['expiry_year'] = $date->format('Y'); $delivery_date = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($delivery_date); $data['deliver_day'] = $date->format('d') ; // Creates date number $data['deliver_month'] = $date->format('m'); // Creates month number $data['deliver_year'] = $date->format('Y'); $validityDate = $data['edit_data2']->validityDate ; // Pull your date from the db $date = new DateTime($validityDate); $data['validityDate_day'] = $date->format('d') ; // Creates date number $data['validityDate_month'] = $date->format('m'); // Creates month number $data['validityDate_year'] = $date->format('Y'); //validityDate $table='sub_order_shades'; $where=array('subOrderID'=>$data['val'] ); $data['edit_data3']=$this->marketing_model->fetch_where_data_edit1($table,$where); // $val=$data['edit_data3']->subOrderID; // $where_con=array('subOrderID'=>$data['val']); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where); $res3=$this->marketing_model->fetch_edit_data_update5($where); $ress=$res3->foreignValue; $where1=$data['edit_data2']->exRate; $data['res4']= $ress * $where1; // print_r($data['res4']); // die(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); //$data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['shadeNo'] = $this->marketing_model->get_shadeNo2($w,'0'); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['indent_p']='monthly_preview'; $this->load->view('templates/header_inside',$data); $this->load->view('marketing/update', $data); $this->load->view('templates/footer_inside'); } public function marketing_edit_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "=") + 1); $table='sub_orders'; //$data['generated_value']=array('id'=>$val); $where=array('id'=>$data['val'] ); $data['edit_data1']=$this->marketing_model->fetch_where_data_edit($table,$where); $w=$data['edit_data1']->orderID; //print_r($data['edit_data1']); //die(); $table='orders'; $where=array('id'=>$w); $data['edit_data2']=$this->marketing_model->fetch_where_data_edit($table,$where); $d = $data['edit_data2']->orderDate ; // Pull your date from the db $date = new DateTime($d); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $dd = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($dd); $data['deliveryDate_day'] = $date->format('d') ; // Creates date number $data['deliveryDate_month'] = $date->format('m'); // Creates month number $data['deliveryDate_year'] = $date->format('Y'); $lc_date = $data['edit_data2']->lcDate ; // Pull your date from the db $date = new DateTime($lc_date); $data['lc_day'] = $date->format('d') ; // Creates date number $data['lc_month'] = $date->format('m'); // Creates month number $data['lc_year'] = $date->format('Y'); $deliver_date = $data['edit_data2']->expiryDate ; // Pull your date from the db $date = new DateTime($deliver_date); $data['expiry_day'] = $date->format('d') ; // Creates date number $data['expiry_month'] = $date->format('m'); // Creates month number $data['expiry_year'] = $date->format('Y'); $delivery_date = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($delivery_date); $data['deliver_day'] = $date->format('d') ; // Creates date number $data['deliver_month'] = $date->format('m'); // Creates month number $data['deliver_year'] = $date->format('Y'); $validityDate = $data['edit_data2']->validityDate ; // Pull your date from the db $date = new DateTime($validityDate); $data['validityDate_day'] = $date->format('d') ; // Creates date number $data['validityDate_month'] = $date->format('m'); // Creates month number $data['validityDate_year'] = $date->format('Y'); //validityDate $table='sub_order_shades'; $where=array('subOrderID'=>$data['val'] ); $data['edit_data3']=$this->marketing_model->fetch_where_data_edit1($table,$where); // $val=$data['edit_data3']->subOrderID; // $where_con=array('subOrderID'=>$data['val']); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where); $res3=$this->marketing_model->fetch_edit_data_update5($where); $ress=$res3->foreignValue; $where1=$data['edit_data2']->exRate; $data['res4']= $ress * $where1; // print_r($data['res4']); // die(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); //$data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['shadeNo'] = $this->marketing_model->get_shadeNo2($w,'0'); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $data['indent_p']='year_preview'; $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/update', $data); $this->load->view('templates/footer_inside'); } public function delete_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $val=$_REQUEST['as']; $table='sub_order_shades'; $where=array('subOrderID'=>$val); $status_val = $this->marketing_model->fetch_main_data($table,$where); if($status_val->planningStatus == 'planned') { $data='not_deleted'; echo json_encode($data); } else { $table='sub_orders'; $where=array('id'=>$val); //$status=array('status'=>1); //$this->marketing_model->update1($status,$where); $this->vendor_model->delete_vendor($table,$where); $table='sub_order_shades'; $where=array('subOrderID'=>$val); //$status=array('status'=>1); //$this->marketing_model->update1($status,$where); $this->vendor_model->delete_vendor($table,$where); $data='deleted'; echo json_encode($data); } } public function shipped_fun() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $val=$_REQUEST['as']; $table='orders'; $where=array('id'=>$val); $data=array('shipped_fun'=>1); $status_val = $this->marketing_model->update($data,$where); echo json_encode($status_val); } public function shipped_fun1() { $rowid = $this->input->post('as'); $val1=$_REQUEST['as']; $this->db->select('orders.shipped_fun'); $this->db->from('orders'); $this->db->where('orders.id',$val1); $query = $this->db->get(); $ret = $query->row(); $getalldata = $this->marketing_model->getsuborder($rowid); $session_array = $this->session->userdata('logged_in'); $approved_by = $session_array['username']; if($ret->shipped_fun == 0){ foreach($getalldata as $key=>$val) { $sub_order_id = $val->id; $cond=array('sub_order_shades.subOrderID'=>$sub_order_id); $info=array('shipping_status'=>'Fully Shipped','shipped_by'=>$approved_by); $getalldata2=$this->marketing_model->addSuborder1($info,$cond); } $table='orders'; $where1=array('id'=>$val1); $data1=array('shipped_fun'=>1); $status_val1 = $this->marketing_model->update($data1,$where1); } else{ foreach($getalldata as $key=>$val) { $sub_order_id = $val->id; $cond=array('sub_order_shades.subOrderID'=>$sub_order_id); $info=array('shipping_status'=>'Pending','shipped_by'=>$approved_by); $getalldata2=$this->marketing_model->addSuborder1($info,$cond); } $table='orders'; $where1=array('id'=>$val1); $data1=array('shipped_fun'=>0); $status_val1 = $this->marketing_model->update($data1,$where1); } echo json_encode($status_val1); } public function shipping(){ $s=$this->input->post('shipping_status'); $id=$this->input->post('as'); $session_array = $this->session->userdata('logged_in'); $approved_by = $session_array['username']; $input=array('shipping_status'=>$s,'shipped_by'=>$approved_by); $where=array('shadeID'=>$id); $this->marketing_model->addSuborder1($input,$where); //print_r($this->db->last_query()); // die(); $orderid = $this->marketing_model->get_order_number($id); $this->db->select('sub_order_shades.shipping_status'); $this->db->from('orders'); $this->db->where('orders.id',$orderid); $this->db->join('sub_orders', 'sub_orders.orderId = orders.id'); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $query = $this->db->get(); $result = $query->result(); $total_result = count($result); $this->db->select('sub_order_shades.shipping_status'); $this->db->from('orders'); $this->db->where('orders.id',$orderid); $this->db->where('sub_order_shades.shipping_status','Fully Shipped'); $this->db->join('sub_orders', 'sub_orders.orderId = orders.id'); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $query1 = $this->db->get(); $result1 = $query1->result(); $fully_sipped_count = count($result1); $this->db->select('sub_order_shades.shipping_status'); $this->db->from('orders'); $this->db->where('orders.id',$orderid); $this->db->where('sub_order_shades.shipping_status','Pending'); $this->db->join('sub_orders', 'sub_orders.orderId = orders.id'); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $query2 = $this->db->get(); $result2 = $query2->result(); $pending_shipped_count = count($result2); if($total_result == $fully_sipped_count){ $table='orders'; $where1=array('id'=>$orderid); $data1=array('shipped_fun'=>1,'shipping_name'=>'Fully Shipped'); $status_val1 = $this->marketing_model->update($data1,$where1); echo json_encode($status_val1); } else if($total_result == $pending_shipped_count){ $table='orders'; $where1=array('id'=>$orderid); $data1=array('shipped_fun'=>0,'shipping_name'=>'Pending'); $status_val1 = $this->marketing_model->update($data1,$where1); echo json_encode($status_val1); } else{ $table='orders'; $where1=array('id'=>$orderid); $data1=array('shipped_fun'=>0,'shipping_name'=>'Partial'); $status_val1 = $this->marketing_model->update($data1,$where1); echo json_encode($status_val1); } //print_r($orderid); } public function update_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $val=$this->input->post('val'); $where=array('id'=>$val); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $where=array('id'=>$max_order_id); $table='orders'; $data['max_order1']=$this->marketing_model->fetch_main_data($table,$where); $transaction_data = array( 'oslNo' => $this->input->post('oslNo'), 'fileNo' => $this->input->post('fileNo'), 'file_type' => $this->input->post('qbweights'), 'orderMode' => $this->input->post('orderMode'), 'orderNo' => $this->input->post('orderNo'), 'partyRef' => $this->input->post('partyName'), 'orderDate' => date('y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))), 'deliveryDate' => date('y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), 'bankername'=>$this->input->post('bankerName'), 'agentname'=>$this->input->post('agentName'), 'paymentTerms' => $this->input->post('paymentTerms'), 'commision'=>$this->input->post('commision'), 'preview1'=>'preview', 'preview2'=>'preview', 'preview3'=>'preview', 'validityDate' => date('y-m-d', strtotime(str_replace('/', '-', $this->input->post('validityDate')))), 'currency' => $this->input->post('currencyName'), 'exRate' => $this->input->post('exRate'), 'lcNo'=>$this->input->post('lcNo'), 'lcDate'=>date('y-m-d', strtotime(str_replace('/', '-', $this->input->post('lcDate')))), 'expiryDate'=>date('y-m-d', strtotime(str_replace('/', '-', $this->input->post('expiryDate')))), 'daysCredit'=>$this->input->post('daysCredit'), 'bank' => $this->input->post('bank'), 'amount' => $this->input->post('amount'), 'customerComments' => $this->input->post('customerComments'), ); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $arti1=$this->input->post('articleNo1'); $arti2=$this->input->post('articleNo2'); if(empty($arti1)) { $articleNo=$this->input->post('articleNo2'); } else { $articleNo=$this->input->post('articleNo1'); } $subCodeData = array( 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'articleNo' => $articleNo, 'article_type' => $this->input->post('article_type'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('design'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'contractType' => $this->input->post('contractType'), 'totalQuantity' => $this->input->post('totalQuantity'), 'totalValue' => $this->input->post('totalValue'), 'discount' => $this->input->post('discount'), 'netValue' => $this->input->post('netValue'), 'indianValue' => $this->input->post('indianValue'), 'freightForwarder' => $this->input->post('freightForwarder'), 'freightType' => $this->input->post('freightType'), 'deliveryMode' => $this->input->post('deliveryMode'), 'deliveryPoint' => $this->input->post('deliveryPoint'), 'packingType' => $this->input->post('packingType'), 'labelTerms' => $this->input->post('labelTerms'), 'packingInstructions' => $this->input->post('packingInstructions'), 'updated_by' => $approved_by, 'updated_on' => date("d-m-Y") ); $shadeID= $this->input->post('shadeID'); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); $unitPrice=$this->input->post('unitPrice'); $foreignValue= $this->input->post('foreignValue'); $deliveryDate=$this->input->post('deliveryDate'); $skuNo= $this->input->post('skuNo'); //print_r($buyerShade);die(); $where=array('id'=>$val); $c=$this->marketing_model->fetch_edit_data($where); $sub_id1=$c->orderID; $where=array('id'=>$sub_id1); $this->db->where($where); $table='orders'; $this->db->update($table,$transaction_data); $condition=array('orderID'=>$sub_id1); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $gen=$generated_subcode->subCode + 1; $subcode_fun=array('subCode'=>$gen); // print_r($generated_subcode); $sub_id2=$c->id; $where=array('id'=>$sub_id2); $this->db->where($where); $table='sub_orders'; $this->db->update($table,$subCodeData); $sub_id=$c->id; $table='sub_order_shades'; $where=array('subOrderID'=>$sub_id); //$cc=$this->marketing_model->fetch_edit_data_update($where); $this->marketing_model->delete($table,$where); foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'unitPrice'=>$unitPrice[$key], 'foreignValue'=>$foreignValue[$key], 'deliveryDate'=>$deliveryDate[$key], 'skuNo'=>$skuNo[$key], 'subOrderID'=>$sub_id, ); $table='sub_order_shades'; $this->db->insert($table,$data); } /* $where=array('shadeID'=>$val->shadeID); $table='sub_order_shades'; $this->db->where($where); $this->db->update($table,$data); echo json_encode($subcode_fun); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/update', $data); $this->load->view('templates/footer_inside');*/ } public function insert_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->marketing_model->max_select(); $q=$id->id; $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $subCodeData = array( 'orderID'=>$q, 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'article_type' => $this->input->post('article_type'), 'articleNo' => $this->input->post('articleNo'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('weave'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'contractType' => $this->input->post('contractType'), 'totalQuantity' => $this->input->post('totalQuantity'), 'totalValue' => $this->input->post('totalValue'), 'discount' => $this->input->post('discount'), 'netValue' => $this->input->post('netValue'), 'indianValue' => $this->input->post('indianValue'), 'freightForwarder' => $this->input->post('freightForwarder'), 'freightType' => $this->input->post('freightType'), 'deliveryMode' => $this->input->post('deliveryMode'), 'deliveryPoint' => $this->input->post('deliveryPoint'), 'packingType' => $this->input->post('packingType'), 'labelTerms' => $this->input->post('labelTerms'), 'packingInstructions' => $this->input->post('packingInstructions'), 'created_by' => $approved_by, 'created_date' => date("d-m-Y") ); $table="sub_orders"; $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); $unitPrice=$this->input->post('unitPrice'); $foreignValue= $this->input->post('foreignValue'); $deliveryDate=$this->input->post('deliveryDate'); $skuNo= $this->input->post('skuNo'); //$table="sub_orders"; //$this->marketing_model->insert($table,$transaction_data); $id=$this->marketing_model->max_select_suborders(); $q=$id->id; foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'unitPrice'=>$unitPrice[$key], 'foreignValue'=>$foreignValue[$key], 'deliveryDate'=>$deliveryDate[$key], 'skuNo'=>$skuNo[$key], 'subOrderID'=>$q, ); $table='sub_order_shades'; $this->db->insert($table,$data); } $condition=array('orderID'=>$max_order_id); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $gen=$generated_subcode->subCode + 1; $subcode_fun=array('subCode'=>$gen); echo json_encode($subcode_fun); } public function insert_generated_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); // $id=$this->marketing_model->max_select(); // $q=$id->id; $gen_val=$this->input->post('gen_val'); $where=array('id'=>$gen_val); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $subCodeData = array( 'orderID'=>$max_order_id, 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'articleNo' => $this->input->post('articleNo'), 'article_type' => $this->input->post('article_type'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('design'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'contractType' => $this->input->post('contractType'), 'totalQuantity' => $this->input->post('totalQuantity'), 'totalValue' => $this->input->post('totalValue'), 'discount' => $this->input->post('discount'), 'netValue' => $this->input->post('netValue'), 'indianValue' => $this->input->post('indianValue'), 'freightForwarder' => $this->input->post('freightForwarder'), 'freightType' => $this->input->post('freightType'), 'deliveryMode' => $this->input->post('deliveryMode'), 'deliveryPoint' => $this->input->post('deliveryPoint'), 'packingType' => $this->input->post('packingType'), 'labelTerms' => $this->input->post('labelTerms'), 'packingInstructions' => $this->input->post('packingInstructions'), 'created_by' => $approved_by, 'created_date' => date("d-m-Y") ); $table="sub_orders"; $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); $unitPrice=$this->input->post('unitPrice'); $foreignValue= $this->input->post('foreignValue'); $deliveryDate=$this->input->post('deliveryDate'); $skuNo= $this->input->post('skuNo'); //$table="sub_orders"; //$this->marketing_model->insert($table,$transaction_data); $id=$this->marketing_model->max_select_suborders(); $q=$id->id; foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'unitPrice'=>$unitPrice[$key], 'foreignValue'=>$foreignValue[$key], 'deliveryDate'=>$deliveryDate[$key], 'skuNo'=>$skuNo[$key], 'subOrderID'=>$q, ); $table='sub_order_shades'; $this->db->insert($table,$data); } $condition=array('orderID'=>$max_order_id); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $gen=$generated_subcode->subCode + 1; $subcode_fun=array('subCode'=>$gen); echo json_encode($subcode_fun); } public function insert_generated_form1() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); // $id=$this->marketing_model->max_select(); // $q=$id->id; $gen_val=$this->input->post('gen_val'); $where=array('id'=>$gen_val); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $condition=array('orderID'=>$max_order_id); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $gen=$generated_subcode->subCode + 1; $subcode_fun=array('subCode'=>$gen); echo json_encode($subcode_fun); } public function display_shadedetails() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $oslNo = $_REQUEST['oslNo']; $table='orders'; $where=array('oslNO'=>$oslNo); $osl_no=$this->marketing_model->fetch_main_data($table,$where); $osl_no_id=$osl_no->id; $subOrderID = $_REQUEST['subOrderID']; $where1=array('subOrderID'=>$subOrderID); $table1='sub_order_shades'; $result=$this->marketing_model->fetch_main_data($table1,$where1); // echo $subOrderID; // print_r($result); $shadeID=$result->shadeID; //echo $shadeID;die(); $data['shadenames'] = $this->marketing_model->getordershade($shadeID,$osl_no_id); $subOrderID = $_REQUEST['subOrderID']; $where1=array('subOrderID'=>$subOrderID); $table1='sub_order_shades'; $data['shades_result']=$this->marketing_model->getorder_shadeid($subOrderID); echo json_encode($data); } public function get_shade_id() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$_REQUEST['id']; $exRate=$_REQUEST['exRate']; $table='sub_order_shades'; $where=array('shadeID'=>$id); $res=$this->marketing_model->fetch_edit_data1($where); $val=$res->subOrderID; $this->marketing_model->delete($table,$where); $where_con=array('subOrderID'=>$val); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where_con); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where_con); $res3=$this->marketing_model->fetch_edit_data_update5($where_con); $ress=$res3->foreignValue; //$where1=$data['edit_data2']->exRate; $data['res4']= $ress * $exRate; echo json_encode($data); } public function update_form_data_based_on_customer() { //print_r($_POST); //die(); $suborder = $this->input->post('subOrderType'); $order_type = $this->marketing_model->getMainorderType($suborder); $main_order_type = $order_type->type; // print_r($this->db->last_query()); // echo $main_order_type; // die(); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $month = date("m"); if ($month == "01" || $month == "02" || $month == "03") { $year = date("Y") - 1; } else { $year = date("Y"); } $orders_oslNo = $this->input->post('oslNo'); $table='orders'; $where=array('oslNo'=>$orders_oslNo); $osl_det=$this->marketing_model->fetch_main_data($table,$where); if($osl_det) { $transaction_data = array( //'oslNo' => $this->input->post('oslNo'), 'oslno_id' => $this->input->post('oslno_id'), 'orderType' => $this->input->post('orderType'), 'fileNo' => $this->input->post('fileNo'), 'file_type' => $this->input->post('qbweights'), 'partyRef' => $this->input->post('partyName'), //'forecastNo' => $this->input->post('forecastNo'), 'orderMode' => $this->input->post('orderMode'), 'orderNo' => $this->input->post('orderNo'), 'bankername'=>$this->input->post('bankerName'), 'agentname'=>$this->input->post('agentName'), 'commision'=>$this->input->post('commision'), 'preview1'=>'preview', 'preview2'=>'preview', 'preview3'=>'preview', 'orderDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))), //'orderRecDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderRecDate')))), 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), //'orderConfirmDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderConfirmDate')))), //'person' => $this->input->post('person'), 'validityDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('validityDate')))), 'currency' => $this->input->post('currencyName'), 'exRate' => $this->input->post('exRate'), 'paymentTerms' => $this->input->post('paymentTerms'), 'lcNo' => $this->input->post('lcNo'), 'lcDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('lcDate')))), 'expiryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('expiryDate')))), 'daysCredit' => $this->input->post('daysCredit'), 'bank' => $this->input->post('bank'), 'amount' => $this->input->post('amount'), 'financial_year' => $year, 'customerComments' => $this->input->post('customerComments') ); //print_r($transaction_data); // $table='orders'; // $this->db->insert($table,$transaction_data); // $id = $this->marketing_model->max_select(); // $q=$id->id; $where = array('oslNo'=>$orders_oslNo); $table='orders'; $this->marketing_model->update_data($where,$table,$transaction_data); //print_r($this->db->last_query()); //print_r($q); $where = array('oslNo'=>$orders_oslNo); $table='orders'; $order_data =$this->marketing_model->fetch_main_data($table,$where); $q = $order_data->id; $order_id = $order_data->id; $sub_order_id = $this->input->post('sub_order_id'); //echo $order_id; // echo $sub_order_id; //die(); $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $articleNo=$this->input->post('articleNo'); $subCodeData = array( //'orderID'=>$q, 'hsn_code' => $this->input->post('hsn_code'), 'pc_length' => $this->input->post('pc_length'), 'valid_from' => $this->input->post('valid_from'), 'valid_till' => $this->input->post('valid_till'), 'composition' => $this->input->post('composition'), 'declaration' => $this->input->post('declaration'), 'product_id' => $this->input->post('product_name'), 'customerComments' => $this->input->post('customerComments'), 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'orders_Type' => $main_order_type, 'unit' => $this->input->post('unit'), 'article_type' => $this->input->post('article_type'), 'articleNo' => $this->input->post('articleNo'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('weave'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'contractType' => $this->input->post('contractType'), 'totalQuantity' => $this->input->post('totalQuantity'), 'totalValue' => $this->input->post('totalValue'), 'discount' => $this->input->post('discount'), 'netValue' => $this->input->post('netValue'), 'indianValue' => $this->input->post('indianValue'), 'freightForwarder' => $this->input->post('freightForwarder'), 'freightType' => $this->input->post('freightType'), 'deliveryMode' => $this->input->post('deliveryMode'), 'deliveryPoint' => $this->input->post('deliveryPoint'), 'packingType' => $this->input->post('packingType'), 'labelTerms' => $this->input->post('labelTerms'), 'packingInstructions' => $this->input->post('packingInstructions'), 'created_by' => $approved_by, 'insert_type' => 'CUSTOMER', 'created_date' => date("d-m-Y") ); //print_r($subCodeData); $where = array('id'=>$sub_order_id); $table='sub_orders'; $this->marketing_model->update_data($where,$table,$subCodeData); // print_r($this->db->last_query()); // $table="sub_orders"; // $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $buyerproductname = $this->input->post('buyerproductname'); $barcode = $this->input->post('barcode'); $vendor_item = $this->input->post('vendor_item'); $quantity= $this->input->post('quantity'); $unitPrice=$this->input->post('unitPrice'); $foreignValue= $this->input->post('foreignValue'); $delivery_date=$this->input->post('delivery_date'); //print_r($delivery); $skuNo= $this->input->post('skuNo'); // 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), //$table="sub_orders"; //$this->marketing_model->insert($table,$transaction_data); $id=$this->marketing_model->max_select_suborders(); $q=$id->id; $table='sub_order_shades'; $where=array('subOrderID'=>$sub_order_id); $this->marketing_model->delete($table,$where); //print_r($this->db->last_query()); foreach($ourShade as $key=>$val) { $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'unitPrice'=>$unitPrice[$key], 'foreignValue'=>$foreignValue[$key], 'deliveryDate'=>$delivery_date[$key], 'skuNo'=>$skuNo[$key], 'buyer_product_name'=>$buyerproductname[$key], 'barcode'=>$barcode[$key], 'vendor_item'=>$vendor_item[$key], 'subOrderID'=>$sub_order_id, ); //print_r($data); $table='sub_order_shades'; $this->db->insert($table,$data); //print_r($this->db->last_query()); } $detailed['res'] = 'updated'; echo json_encode($detailed); } else{ $detailed['res'] = 'notupdated'; echo json_encode($detailed); } } public function insert_form_data_based_on_customer() { $suborder = $this->input->post('subOrderType'); $order_type = $this->marketing_model->getMainorderType($suborder); $main_order_type = $order_type->type; // print_r($this->db->last_query()); // echo $main_order_type; // die(); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $month = date("m"); if ($month == "01" || $month == "02" || $month == "03") { $year = date("Y") - 1; } else { $year = date("Y"); } $orders_oslNo = $this->input->post('oslNo'); $table='orders'; $where=array('oslNo'=>$orders_oslNo); $osl_det=$this->marketing_model->fetch_main_data($table,$where); if(empty($osl_det)) { $transaction_data = array( 'oslNo' => $this->input->post('oslNo'), 'oslno_id' => $this->input->post('oslno_id'), 'orderType' => $this->input->post('orderType'), 'fileNo' => $this->input->post('fileNo'), 'file_type' => $this->input->post('qbweights'), 'partyRef' => $this->input->post('partyName'), //'forecastNo' => $this->input->post('forecastNo'), 'orderMode' => $this->input->post('orderMode'), 'orderNo' => $this->input->post('orderNo'), 'bankername'=>$this->input->post('bankerName'), 'agentname'=>$this->input->post('agentName'), 'commision'=>$this->input->post('commision'), 'preview1'=>'preview', 'preview2'=>'preview', 'preview3'=>'preview', 'orderDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))), //'orderRecDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderRecDate')))), 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), 'ship_window_start' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('ship_window_start')))), 'ship_window_end' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('ship_window_end')))), //'orderConfirmDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderConfirmDate')))), //'person' => $this->input->post('person'), 'validityDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('validityDate')))), 'currency' => $this->input->post('currencyName'), 'exRate' => $this->input->post('exRate'), 'paymentTerms' => $this->input->post('paymentTerms'), 'lcNo' => $this->input->post('lcNo'), 'lcDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('lcDate')))), 'expiryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('expiryDate')))), 'daysCredit' => $this->input->post('daysCredit'), 'bank' => $this->input->post('bank'), 'amount' => $this->input->post('amount'), 'financial_year' => $year, 'customerComments' => $this->input->post('customerComments') ); $table='orders'; $this->db->insert($table,$transaction_data); //print_r($this->db->last_query()); //die(); $id=$this->marketing_model->max_select(); $q=$id->id; //print_r($q); $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $articleNo=$this->input->post('articleNo'); $subCodeData = array( 'orderID'=>$q, 'hsn_code' => $this->input->post('hsn_code'), 'pc_length' => $this->input->post('pc_length'), 'valid_from' => $this->input->post('valid_from'), 'valid_till' => $this->input->post('valid_till'), 'composition' => $this->input->post('composition'), 'declaration' => $this->input->post('declaration'), 'product_id' => $this->input->post('product_name'), 'customerComments' => $this->input->post('customerComments'), 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'orders_Type' => $main_order_type, 'unit' => $this->input->post('unit'), 'article_type' => $this->input->post('article_type'), 'articleNo' => $this->input->post('articleNo'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('weave'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'contractType' => $this->input->post('contractType'), 'totalQuantity' => $this->input->post('totalQuantity'), 'totalValue' => $this->input->post('totalValue'), 'discount' => $this->input->post('discount'), 'netValue' => $this->input->post('netValue'), 'indianValue' => $this->input->post('indianValue'), 'freightForwarder' => $this->input->post('freightForwarder'), 'freightType' => $this->input->post('freightType'), 'deliveryMode' => $this->input->post('deliveryMode'), 'deliveryPoint' => $this->input->post('deliveryPoint'), 'packingType' => $this->input->post('packingType'), 'labelTerms' => $this->input->post('labelTerms'), 'packingInstructions' => $this->input->post('packingInstructions'), 'created_by' => $approved_by, 'insert_type' => 'CUSTOMER', 'created_date' => date("d-m-Y") ); $table="sub_orders"; $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $buyerproductname = $this->input->post('buyerproductname'); $vendor_item = $this->input->post('vendor_item'); $barcode = $this->input->post('barcode'); $quantity= $this->input->post('quantity'); $unitPrice=$this->input->post('unitPrice'); $foreignValue= $this->input->post('foreignValue'); $delivery_date=$this->input->post('delivery_date'); //print_r($delivery); $skuNo= $this->input->post('skuNo'); // 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), //$table="sub_orders"; //$this->marketing_model->insert($table,$transaction_data); $id=$this->marketing_model->max_select_suborders(); $q=$id->id; foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'unitPrice'=>$unitPrice[$key], 'foreignValue'=>$foreignValue[$key], 'deliveryDate'=>$delivery_date[$key], 'skuNo'=>$skuNo[$key], 'buyer_product_name'=>$buyerproductname[$key], 'barcode'=>$barcode[$key], 'vendor_item'=>$vendor_item[$key], 'subOrderID'=>$q, ); $table='sub_order_shades'; $this->db->insert($table,$data); } $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $o_date = date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))); $d_date = date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))); $osl_num=$this->input->post('oslNo'); $this->load->library('email'); $this->email->set_mailtype('html'); $msgs = "Hello, The OSL No."." ".$osl_num." "."has been initiated by ".$approved_by." "."Order Date is ".$o_date." " ."and Delivery Date is ".$d_date; $this->email->set_newline("\r\n"); $list = array('management@swansilk.com'); $this->email->from('info@deco-textil.com'); $this->email->to($list); $this->email->subject('New Order'); $data['message'] = $msgs; $this->email->message($msgs); $this->email->send(); $id=$this->marketing_model->max_select(); $q=$id->id; //print_r($q); $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $condition=array('orderID'=>$max_order_id); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $detailed['gen']=$generated_subcode->subCode + 1; $detailed['res']='not_inserted'; $subcode_fun=array('subCode'=>$detailed['gen']); echo json_encode($detailed); } else { $oslvalue = $this->input->post('orderType'); //$oslvalue = substr($uri, strpos($uri, "=") + 1); $newOSL = $this->marketing_model->generateOSL($oslvalue); $detailed['osl']=$newOSL['osl']; $detailed['res']='inserted'; echo json_encode($detailed); } } public function insert_osl_customer_based() { // print_r($_POST); // die(); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->marketing_model->max_select(); $q=$id->id; $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $articleNo = $this->input->post('articleNo'); $subCodeData = array( 'orderID'=>$q, 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'article_type' => $this->input->post('article_type'), 'articleNo' => $this->input->post('articleNo'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('weave'), 'delete' => 'delete', 'edit' => 'edit', 'hsn_code' => $this->input->post('hsn_code'), 'pc_length' => $this->input->post('pc_length'), 'valid_from' => $this->input->post('valid_from'), 'valid_till' => $this->input->post('valid_till'), 'composition' => $this->input->post('composition'), 'declaration' => $this->input->post('declaration'), 'product_id' => $this->input->post('product_name'), 'customerComments' => $this->input->post('customerComments'), 'description' => $this->input->post('description'), 'contractType' => $this->input->post('contractType'), 'totalQuantity' => $this->input->post('totalQuantity'), 'totalValue' => $this->input->post('totalValue'), 'discount' => $this->input->post('discount'), 'netValue' => $this->input->post('netValue'), 'indianValue' => $this->input->post('indianValue'), 'freightForwarder' => $this->input->post('freightForwarder'), 'freightType' => $this->input->post('freightType'), 'deliveryMode' => $this->input->post('deliveryMode'), 'deliveryPoint' => $this->input->post('deliveryPoint'), 'packingType' => $this->input->post('packingType'), 'labelTerms' => $this->input->post('labelTerms'), 'packingInstructions' => $this->input->post('packingInstructions'), 'created_by' => $approved_by, 'insert_type' => 'CUSTOMER', 'created_date' => date("d-m-Y") ); $table="sub_orders"; $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); $unitPrice=$this->input->post('unitPrice'); $foreignValue= $this->input->post('foreignValue'); $deliveryDate=$this->input->post('deliveryDate'); $skuNo= $this->input->post('skuNo'); $buyerproductname = $this->input->post('buyerproductname'); $barcode = $this->input->post('barcode'); //$table="sub_orders"; //$this->marketing_model->insert($table,$transaction_data); $id=$this->marketing_model->max_select_suborders(); $q=$id->id; foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'unitPrice'=>$unitPrice[$key], 'foreignValue'=>$foreignValue[$key], 'deliveryDate'=>$deliveryDate[$key], 'skuNo'=>$skuNo[$key], 'subOrderID'=>$q, 'buyer_product_name'=>$buyerproductname[$key], 'barcode'=>$barcode[$key], ); $table='sub_order_shades'; $this->db->insert($table,$data); } $condition=array('orderID'=>$max_order_id); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $gen=$generated_subcode->subCode + 1; $subcode_fun=array('subCode'=>$gen); echo json_encode($subcode_fun); } public function insert_form_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $month = date("m"); if ($month == "01" || $month == "02" || $month == "03") { $year = date("Y") - 1; } else { $year = date("Y"); } $orders_oslNo = $this->input->post('oslNo'); $table='orders'; $where=array('oslNo'=>$orders_oslNo); $osl_det=$this->marketing_model->fetch_main_data($table,$where); if(empty($osl_det)) { $transaction_data = array( 'oslNo' => $this->input->post('oslNo'), 'oslno_id' => $this->input->post('oslno_id'), 'orderType' => $this->input->post('orderType'), 'fileNo' => $this->input->post('fileNo'), 'file_type' => $this->input->post('qbweights'), 'partyRef' => $this->input->post('partyName'), //'forecastNo' => $this->input->post('forecastNo'), 'orderMode' => $this->input->post('orderMode'), 'orderNo' => $this->input->post('orderNo'), 'bankername'=>$this->input->post('bankerName'), 'agentname'=>$this->input->post('agentName'), 'commision'=>$this->input->post('commision'), 'preview1'=>'preview', 'preview2'=>'preview', 'preview3'=>'preview', 'orderDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))), //'orderRecDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderRecDate')))), 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), //'orderConfirmDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderConfirmDate')))), //'person' => $this->input->post('person'), 'validityDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('validityDate')))), 'currency' => $this->input->post('currencyName'), 'exRate' => $this->input->post('exRate'), 'paymentTerms' => $this->input->post('paymentTerms'), 'lcNo' => $this->input->post('lcNo'), 'lcDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('lcDate')))), 'expiryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('expiryDate')))), 'daysCredit' => $this->input->post('daysCredit'), 'bank' => $this->input->post('bank'), 'amount' => $this->input->post('amount'), 'financial_year' => $year, 'customerComments' => $this->input->post('customerComments') ); $table='orders'; $this->db->insert($table,$transaction_data); $id=$this->marketing_model->max_select(); $q=$id->id; //print_r($q); $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $subCodeData = array( 'orderID'=>$q, 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'article_type' => $this->input->post('article_type'), 'articleNo' => $this->input->post('articleNo'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('weave'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'contractType' => $this->input->post('contractType'), 'totalQuantity' => $this->input->post('totalQuantity'), 'totalValue' => $this->input->post('totalValue'), 'discount' => $this->input->post('discount'), 'netValue' => $this->input->post('netValue'), 'indianValue' => $this->input->post('indianValue'), 'freightForwarder' => $this->input->post('freightForwarder'), 'freightType' => $this->input->post('freightType'), 'deliveryMode' => $this->input->post('deliveryMode'), 'deliveryPoint' => $this->input->post('deliveryPoint'), 'packingType' => $this->input->post('packingType'), 'labelTerms' => $this->input->post('labelTerms'), 'packingInstructions' => $this->input->post('packingInstructions'), 'created_by' => $approved_by, 'created_date' => date("d-m-Y") ); $table="sub_orders"; $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); $unitPrice=$this->input->post('unitPrice'); $foreignValue= $this->input->post('foreignValue'); $delivery_date=$this->input->post('delivery_date'); //print_r($delivery); $skuNo= $this->input->post('skuNo'); // 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), //$table="sub_orders"; //$this->marketing_model->insert($table,$transaction_data); $id=$this->marketing_model->max_select_suborders(); $q=$id->id; foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'unitPrice'=>$unitPrice[$key], 'foreignValue'=>$foreignValue[$key], 'deliveryDate'=>$delivery_date[$key], 'skuNo'=>$skuNo[$key], 'subOrderID'=>$q, ); $table='sub_order_shades'; $this->db->insert($table,$data); } $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $o_date = date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))); $d_date = date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))); $osl_num=$this->input->post('oslNo'); $this->load->library('email'); $this->email->set_mailtype('html'); $msgs = "Hello, The OSL No."." ".$osl_num." "."has been initiated by ".$approved_by." "."Order Date is ".$o_date." " ."and Delivery Date is ".$d_date; $this->email->set_newline("\r\n"); $list = array('management@swansilk.com'); $this->email->from('info@deco-textil.com'); $this->email->to($list); $this->email->subject('New Order'); $data['message'] = $msgs; $this->email->message($msgs); $this->email->send(); $id=$this->marketing_model->max_select(); $q=$id->id; //print_r($q); $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $condition=array('orderID'=>$max_order_id); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $detailed['gen']=$generated_subcode->subCode + 1; $detailed['res']='not_inserted'; $subcode_fun=array('subCode'=>$detailed['gen']); echo json_encode($detailed); } else { $oslvalue = $this->input->post('orderType'); //$oslvalue = substr($uri, strpos($uri, "=") + 1); $newOSL = $this->marketing_model->generateOSL($oslvalue); $detailed['osl']=$newOSL['osl']; $detailed['res']='inserted'; echo json_encode($detailed); } } public function insert_transaction_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $t=$this->marketing_model->max_select_template(); $template_no=$t->templateNo + 1; $month = date("m"); if ($month == "01" || $month == "02" || $month == "03") { $year = date("Y") - 1; } else { $year = date("Y"); } $transaction_data = array( 'oslNo' => $this->input->post('oslNo'), 'oslno_id' => $this->input->post('oslno_id'), 'orderType' => $this->input->post('orderType'), 'fileNo' => $this->input->post('fileNo'), 'file_type' => $this->input->post('qbweights'), 'partyRef' => $this->input->post('partyName'), //'forecastNo' => $this->input->post('forecastNo'), 'orderMode' => $this->input->post('orderMode'), 'orderNo' => $this->input->post('orderNo'), 'bankername'=>$this->input->post('bankerName'), 'agentname'=>$this->input->post('agentName'), 'commision'=>$this->input->post('commision'), 'orderDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))), //'orderRecDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderRecDate')))), 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), //'orderConfirmDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderConfirmDate')))), //'person' => $this->input->post('person'), 'validityDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('validityDate')))), 'currency' => $this->input->post('currencyName'), 'exRate' => $this->input->post('exRate'), 'paymentTerms' => $this->input->post('paymentTerms'), 'lcNo' => $this->input->post('lcNo'), 'lcDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('lcDate')))), 'expiryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('expiryDate')))), 'daysCredit' => $this->input->post('daysCredit'), 'bank' => $this->input->post('bank'), 'amount' => $this->input->post('amount'), 'financial_year' => $year, 'customerComments' => $this->input->post('customerComments'), 'templateNo' => $template_no ); $table='transaction_orders'; $this->db->insert($table,$transaction_data); $id=$this->marketing_model->max_select1(); $q=$id->id; $subCodeData = array( 'orderID'=>$q, 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'article_type' => $this->input->post('article_type'), 'articleNo' => $this->input->post('articleNo'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('weave'), 'description' => $this->input->post('description'), 'contractType' => $this->input->post('contractType'), 'totalQuantity' => $this->input->post('totalQuantity'), 'totalValue' => $this->input->post('totalValue'), 'discount' => $this->input->post('discount'), 'netValue' => $this->input->post('netValue'), 'indianValue' => $this->input->post('indianValue'), 'freightForwarder' => $this->input->post('freightForwarder'), 'freightType' => $this->input->post('freightType'), 'deliveryMode' => $this->input->post('deliveryMode'), 'deliveryPoint' => $this->input->post('deliveryPoint'), 'packingType' => $this->input->post('packingType'), 'labelTerms' => $this->input->post('labelTerms'), 'packingInstructions' => $this->input->post('packingInstructions'), ); $table="transaction_suborder"; $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); $unitPrice=$this->input->post('unitPrice'); $foreignValue= $this->input->post('foreignValue'); $delivery_date=$this->input->post('delivery_date'); //print_r($delivery); $skuNo= $this->input->post('skuNo'); // 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), //$table="sub_orders"; //$this->marketing_model->insert($table,$transaction_data); $id=$this->marketing_model->max_select_suborders1(); $q=$id->id; foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'unitPrice'=>$unitPrice[$key], 'foreignValue'=>$foreignValue[$key], 'deliveryDate'=>$delivery_date[$key], 'skuNo'=>$skuNo[$key], 'subOrderID'=>$q, ); $table='transaction_shades'; $this->db->insert($table,$data); } } public function fetchdata() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $yarnname = $_REQUEST['q']; $warpdenier = $this->marketing_model->getwarpdenier($yarnname); echo json_encode($warpdenier); } public function fetchshade() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $product_id = $_REQUEST['q']; $shade = $this->marketing_model->getshade($product_id); echo json_encode($shade); } public function fetchshadedetails() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $shade = $_REQUEST['q']; $product_id = $_REQUEST['product_id']; //echo 'shade'.$shade; $shade_details = $this->marketing_model->getshadedetails($shade,$product_id); //print_r($this->db->last_query()); //die(); echo json_encode($shade_details); } public function display_shadedetails_1() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $oslNo = $_REQUEST['oslNo']; $subOrderID = $_REQUEST['subOrderID']; $table='transaction_orders'; $where=array('fileNo'=>$oslNo,'templateNo'=>$subOrderID); $data['osl_no']=$this->marketing_model->fetch_main_data($table,$where); $osl_no_id=$data['osl_no']->id; $where1=array('orderID'=>$osl_no_id); $table1='transaction_suborder'; $data['result1']=$this->marketing_model->fetch_main_data($table1,$where1); $orderid=$data['result1']->id; $where2=array('subOrderID'=>$orderid); $table2='transaction_shades'; $data['result']=$this->marketing_model->get_where_data($table2,$where2); //$shadeID=$data['result']->shadeID; //echo $shadeID;die(); //$table2='transaction_shades'; $data['shadenames'] = $this->marketing_model->getordershade_1($orderid); //print_r($data['shadenames']); //die(); echo json_encode($data); } public function display_shadedetails1() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $fileNo = $_REQUEST['fileNo']; $table='transaction_orders'; $where=array('fileNo'=>$fileNo); $osl_no=$this->marketing_model->fetch_main_data($table,$where); $osl_no_id=$osl_no->id; $subOrderID = $_REQUEST['subOrderID']; $where1=array('subOrderID'=>$subOrderID); $table1='sub_order_shades'; $result=$this->marketing_model->fetch_main_data($table1,$where1); // echo $subOrderID; // print_r($result); $shadeID=$result->shadeID; //echo $shadeID;die(); $shadenames = $this->marketing_model->getordershade($shadeID,$osl_no_id); echo json_encode($shadenames); } public function edit_customer_master_details($orderID = "") { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $where1=array('id'=>$orderID); $table1='customer_master'; $data['result']=$this->marketing_model->fetch_main_data($table1,$where1); $res=$data['result']->country; $where2=array('id'=>$res); $table2='country'; $res1=$this->marketing_model->fetch_main_data($table2,$where2); $res_date=$data['result']->agencyFromDate; $date = new DateTime($res_date); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $data['res_country']=$res1->country; $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['country'] = $this->yarn_model->getcountries(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/edit_customer_details', $data); $this->load->view('templates/footer_inside'); } public function update_customer() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $agentname = $this->input->post('agentname'); $agentAddress = $this->input->post('agentAddress'); $agentContactperson = $this->input->post('agentcontactperson'); $agentMobile = implode(',', $this->input->post('agentmobile')); $agentPhone = implode(',', $this->input->post('agentphone')); $agentEmail = implode(',', $this->input->post('agentemail')); $agentWebsite = $this->input->post('agentwebsite'); $agentCommission = $this->input->post('agentCommission'); $agencyFromDate = explode("/", $this->input->post('agentValidityDate'))[2] . '-' . explode("/", $this->input->post('agentValidityDate'))[1] . '-' . explode("/", $this->input->post('agentValidityDate'))[0]; $country=$this->input->post('country'); $query = $this->db->query('SELECT * FROM country where country="' . $country . '"'); $res = $query->row(); if ($this->input->post('opennotesdiv')) { $notes = implode(',', $this->input->post('notes')); } else { $notes = ""; } $id = $this->input->post('customer_id'); $idd=$this->session->userdata('logged_in'); $where=array('id'=>$idd); $data['approved_by']=$idd['username']; $d=date('d-m-Y'); $customer_data = array( 'productType' => $this->input->post('productType'), 'customerAddress' => $this->input->post('customerAddress'), 'city' => $this->input->post('city'), 'pincode' => $this->input->post('pincode'), 'country' => $res->id, 'bankerName' => $this->input->post('bankerName'), 'bankerAddress' => $this->input->post('bankerAddress'), 'department' => $this->input->post('department'), 'mobile' => implode(",", $this->input->post('mobileno')), 'phoneNo' => implode(",", $this->input->post('phoneno')), 'email' => implode(",", $this->input->post('email')), 'website' => implode(",", $this->input->post('website')), 'consigneeName' => $this->input->post('consigneename'), 'consigneeAddress' => $this->input->post('consigneeAddress'), 'notes' => $notes, 'agentName' => $agentname, 'agentAddress' => $agentAddress, 'agentContactperson' => $agentContactperson, 'agentMobile' => $agentMobile, 'agentPhone' => $agentPhone, 'agentEmail' => $agentEmail, 'agentWebsite' => $agentWebsite, 'agentCommission' => $agentCommission, 'agencyFromDate' => $agencyFromDate, 'updated_by'=>$data['approved_by'], 'updated_on'=>$d ); $where = array('id'=>$id); $table='customer_master'; $this->marketing_model->update_data($where,$table,$customer_data); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $this->load->view('templates/header_inside',$data); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('marketing/customer_master_details', $data); $this->load->view('templates/footer_inside'); } public function delete_customer_master_details($orderID = "") { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $where1=array('id'=>$orderID); $table1='customer_master'; $this->marketing_model->delete($table1,$where1); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/customer_master_details', $data); $this->load->view('templates/footer_inside'); } public function delete_product_details($orderID = "") { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $where1=array('productID'=>$orderID); $table1='product_master'; $this->marketing_model->delete($table1,$where1); $data['getalldata'] = $this->marketing_model->display_product_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/product_details', $data); $this->load->view('templates/footer_inside'); } public function edit_product_details($orderID = "") { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $where1=array('productID'=>$orderID); $table1='product_master'; $data['result']=$this->marketing_model->fetch_main_data($table1,$where1); // print_r($data['result']); // die(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/edit_product_details',$data); $this->load->view('templates/footer_inside'); } public function update_product() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $idd=$this->session->userdata('logged_in'); $where=array('id'=>$idd); $data['approved_by']=$idd['username']; $d=date('d-m-Y'); $id = $this->input->post('id'); $product_data = array( 'type' => $this->input->post('type'), 'fabricCode' => $this->input->post('fabricCode'), 'fabricType' => $this->input->post('fabricType'), 'sides' => $this->input->post('sides'), 'updated_by'=>$data['approved_by'], 'updated_on'=>$d ); $where = array('productID'=>$id); $table='product_master'; $this->marketing_model->update_data($where,$table,$product_data); $data['getalldata'] = $this->marketing_model->display_product_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/product_details', $data); $this->load->view('templates/footer_inside'); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public function get_osl_subcode_firs1t() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $oslvalue = $_REQUEST['orderType']; $newOSL = $this->marketing_model->generateOSL($oslvalue); echo json_encode($newOSL); } public function get_osl_subcode_first_new() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $oslvalue = substr($uri, strpos($uri, "=") + 1); $newOSL = $this->marketing_model->generateOSL($oslvalue); //echo $newOSL; //die(); $data['osl']=$newOSL['osl']; $data['sub']=$newOSL['sub']; $data['subcode']=1; $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $_POST['orderTypes'] = $data['orderTypes']; $data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/osl_marketing_new', $data); $this->load->view('templates/footer_inside'); } public function get_osl_subcode_first() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $oslvalue = substr($uri, strpos($uri, "=") + 1); $newOSL = $this->marketing_model->generateOSL($oslvalue); $data['osl']=$newOSL['osl']; $data['sub']=$newOSL['sub']; $data['subcode']=1; $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $_POST['orderTypes'] = $data['orderTypes']; $data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/osl_marketing', $data); $this->load->view('templates/footer_inside'); } public function get_sam_subcode_first() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $oslvalue = substr($uri, strpos($uri, "=") + 1); $newOSL = $this->marketing_model->generateOSL($oslvalue); $data['osl']=$newOSL['osl']; $data['sub']=$newOSL['sub']; $data['subcode']=1; $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $_POST['orderTypes'] = $data['orderTypes']; $data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/sam_marketing', $data); $this->load->view('templates/footer_inside'); } public function get_stk_subcode_first() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $oslvalue = substr($uri, strpos($uri, "=") + 1); $newOSL = $this->marketing_model->generateOSL($oslvalue); $data['osl']=$newOSL['osl']; $data['sub']=$newOSL['sub']; $data['subcode']=1; $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $_POST['orderTypes'] = $data['orderTypes']; $data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/stk_marketing', $data); $this->load->view('templates/footer_inside'); } public function insert_sam_form_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $month = date("m"); if ($month == "01" || $month == "02" || $month == "03") { $year = date("Y") - 1; } else { $year = date("Y"); } $transaction_data = array( 'oslNo' => $this->input->post('oslNo'), 'oslno_id' => $this->input->post('oslno_id'), 'orderType' => $this->input->post('orderType'), 'fileNo' => $this->input->post('fileNo'), 'file_type' => $this->input->post('qbweights'), 'partyRef' => $this->input->post('partyName'), //'forecastNo' => $this->input->post('forecastNo'), 'orderMode' => $this->input->post('orderMode'), 'orderNo' => $this->input->post('orderNo'), 'financial_year' => $year, 'preview1'=>'preview', 'preview2'=>'preview', 'preview3'=>'preview', 'orderDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))), 'deliveryDate' => date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), 'customerComments' => $this->input->post('customerComments') ); $table='orders'; $this->db->insert($table,$transaction_data); $id=$this->marketing_model->max_select(); $q=$id->id; //print_r($q); $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $subCodeData = array( 'orderID'=>$q, 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'article_type' => $this->input->post('article_type'), 'articleNo' => $this->input->post('articleNo'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('weave'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'created_by' => $approved_by, 'created_date' => date("d-m-Y") ); $table="sub_orders"; $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); $id=$this->marketing_model->max_select_suborders(); $q=$id->id; foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'subOrderID'=>$q, ); $table='sub_order_shades'; $this->db->insert($table,$data); } $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $o_date = date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))); $d_date = date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))); $osl_num=$this->input->post('oslNo'); $this->load->library('email'); $this->email->set_mailtype('html'); $msgs = "Hello, The OSL No."." ".$osl_num." "."has been initiated by ".$approved_by." "."Order Date is ".$o_date." " ."and Delivery Date is ".$d_date; $this->email->set_newline("\r\n"); $list = array('management@swansilk.com'); $this->email->from('info@deco-textil.com'); $this->email->to($list); $this->email->subject('New Order'); $data['message'] = $msgs; $this->email->message($msgs); $this->email->send(); $id=$this->marketing_model->max_select(); $q=$id->id; //print_r($q); $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $condition=array('orderID'=>$max_order_id); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $gen=$generated_subcode->subCode + 1; //echo $gen; $subcode_fun=array('subCode'=>$gen); echo json_encode($gen); } public function insert_sam_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->marketing_model->max_select(); $q=$id->id; $where=array('orderID'=>$q); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $subCodeData = array( 'orderID'=>$q, 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'article_type' => $this->input->post('article_type'), 'articleNo' => $this->input->post('articleNo'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('weave'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'created_by' => $approved_by, 'created_date' => date("d-m-Y") ); $table="sub_orders"; $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); $id=$this->marketing_model->max_select_suborders(); $q=$id->id; foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'subOrderID'=>$q, ); $table='sub_order_shades'; $this->db->insert($table,$data); } $condition=array('orderID'=>$max_order_id); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $gen=$generated_subcode->subCode + 1; $subcode_fun=array('subCode'=>$gen); echo json_encode($subcode_fun); } public function getorder_sam_details() { $get = $this->uri->segment(3); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $getalldata1 = $this->marketing_model->getorder_sam_details(); foreach($getalldata1 as $v) { $orderID=$v->id; $status=0; $details=$this->marketing_model->get_shadeNo_status($orderID, $status); if(empty($details)) { $data=array('confirm_status' => 'CONFIRMED'); $where=array('id' => $orderID); $table = 'orders'; $this->marketing_model->update_data($where,$table,$data); } else { $data=array('confirm_status' => 'PENDING'); $where=array('id' => $orderID); $table = 'orders'; $this->marketing_model->update_data($where,$table,$data); } } $m=date('m'); $y=date('Y'); if($get == 'stoday_dashboard') { $m=date('m'); $y=date('Y'); $d1=date('d-m-Y'); $table='sub_orders'; $where=array('created_date'=>$d1); $dd='SAM'; $getalldata=$this->vendor_model->marketing_res_dashboard_po_list_id($d1,$dd); } else if($get == 'sindent') { $getalldata = $this->marketing_model->getorder_sams_details(); } else if($get == 'smonth_dashboard') { $m=date('m'); $y=date('Y'); $d1=date('d-m-Y'); $table='sub_orders'; $where=array('created_date'=>$d1); $dd='SAM'; $getalldata=$this->vendor_model->monthly_marketing_res_dashboard_po_list_id($table,$m,$y,$dd); } else if($get == 'syear_dashboard') { $m=date('m'); $y=date('Y'); $d1=date('d-m-Y'); $table='sub_orders'; $where=array('created_date'=>$d1); $dd='SAM'; $getalldata=$this->vendor_model->year_marketing_res_dashboard_po_list_id($table,$y,$dd); } echo json_encode($getalldata); } public function getorder_stk_details() { $get = $this->uri->segment(3); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $getalldata1 = $this->marketing_model->getorder_sdk_details(); foreach($getalldata1 as $v) { $orderID=$v->id; $status=0; $details=$this->marketing_model->get_shadeNo_status($orderID, $status); if(empty($details)) { $data=array('confirm_status' => 'CONFIRMED'); $where=array('id' => $orderID); $table = 'orders'; $this->marketing_model->update_data($where,$table,$data); } else { $data=array('confirm_status' => 'PENDING'); $where=array('id' => $orderID); $table = 'orders'; $this->marketing_model->update_data($where,$table,$data); } } $m=date('m'); $y=date('Y'); if($get == 'stoday_dashboard') { $m=date('m'); $y=date('Y'); $d1=date('d-m-Y'); $table='sub_orders'; $where=array('created_date'=>$d1); $dd='STK'; $getalldata=$this->vendor_model->marketing_res_dashboard_po_list_id($d1,$dd); } else if($get == 'sindent') { $getalldata = $this->marketing_model->getorder_sdks_details(); } else if($get == 'smonth_dashboard') { $m=date('m'); $y=date('Y'); $d1=date('d-m-Y'); $table='sub_orders'; $where=array('created_date'=>$d1); $dd='STK'; $getalldata=$this->vendor_model->monthly_marketing_res_dashboard_po_list_id($table,$m,$y,$dd); } else if($get == 'syear_dashboard') { $m=date('m'); $y=date('Y'); $d1=date('d-m-Y'); $table='sub_orders'; $where=array('created_date'=>$d1); $dd='STK'; $getalldata=$this->vendor_model->year_marketing_res_dashboard_po_list_id($table,$y,$dd); } echo json_encode($getalldata); } public function delete_sam_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $vall = substr($uri, strpos($uri, "=") + 1); $table='sub_orders'; $where=array('id'=>$vall); $status=array('status'=>1); $this->marketing_model->update1($status,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "&") + 1); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; //<!----add from-------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_id=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_id); $dept_id_row=$this->vendor_model->get_where_row($table,$where); $user_type_id_row=$dept_id_row->user_type_id; //----------tiill-------------------- $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $check=""; foreach($m_id as $menu_id) { $table='swansilk_menu'; $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); $result= $this->marketing_model->fetch_main_data($table,$where); if(!empty($result->reference_url)){ if($result->reference_url == $data['val']) { $check=$data['val']; } } } if($check != "") { //<!----add from -------------> $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $data1=array(); foreach($m_id as $menu_id) { $table='access_action_rights'; $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); $arr=$this->vendor_model->get_where_row($table,$where); if(empty($arr)) { } else { //print_r($arr); $menu_id=$arr->menu_id; $table='swansilk_menu'; $where=array('menu_id'=>$menu_id); $url=$this->vendor_model->get_where_row($table,$where); if(!empty($url->reference_url)){ if($url->reference_url == $data['val']) { $data['access_row']=$arr; } } } } //----------tiill-------------------- $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $data['designdata'] = $this->marketing_model->display_design_data(); $data['getalldata'] = $this->planning_shade->display_yarnqty_data(); $data['articledata'] = $this->planning_shade->display_article_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('planning_module/sam_sdk_pgm',$data); $this->load->view('templates/footer_inside'); } else { // $this->session->sess_destroy(); // redirect(base_url()); } // $data['getalldata'] = $this->marketing_model->display_transaction_data(); // //echo '<pre>';print_R($data['getalldata']);exit; // $data['userdetails'] = $this->session_data_pass(); // $data['user_type_id'] = $this->access_id(); // $data['access'] = $this->access_details(); // $this->load->view('templates/header_inside',$data); // $this->load->view('planning_module/sam_sdk_pgm',$data); // $this->load->view('templates/footer_inside'); } public function sam_edit_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "=") + 1); $table='sub_orders'; //$data['generated_value']=array('id'=>$val); $where=array('id'=>$data['val'] ); $data['edit_data1']=$this->marketing_model->fetch_where_data_edit($table,$where); $w=$data['edit_data1']->orderID; //print_r($data['edit_data1']); //die(); $table='orders'; $where=array('id'=>$w); $data['edit_data2']=$this->marketing_model->fetch_where_data_edit($table,$where); $d = $data['edit_data2']->orderDate ; // Pull your date from the db $date = new DateTime($d); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $dd = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($dd); $data['deliveryDate_day'] = $date->format('d') ; // Creates date number $data['deliveryDate_month'] = $date->format('m'); // Creates month number $data['deliveryDate_year'] = $date->format('Y'); $lc_date = $data['edit_data2']->lcDate ; // Pull your date from the db $date = new DateTime($lc_date); $data['lc_day'] = $date->format('d') ; // Creates date number $data['lc_month'] = $date->format('m'); // Creates month number $data['lc_year'] = $date->format('Y'); $deliver_date = $data['edit_data2']->expiryDate ; // Pull your date from the db $date = new DateTime($deliver_date); $data['expiry_day'] = $date->format('d') ; // Creates date number $data['expiry_month'] = $date->format('m'); // Creates month number $data['expiry_year'] = $date->format('Y'); $delivery_date = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($delivery_date); $data['deliver_day'] = $date->format('d') ; // Creates date number $data['deliver_month'] = $date->format('m'); // Creates month number $data['deliver_year'] = $date->format('Y'); $validityDate = $data['edit_data2']->validityDate ; // Pull your date from the db $date = new DateTime($validityDate); $data['validityDate_day'] = $date->format('d') ; // Creates date number $data['validityDate_month'] = $date->format('m'); // Creates month number $data['validityDate_year'] = $date->format('Y'); //validityDate $table='sub_order_shades'; $where=array('subOrderID'=>$data['val'] ); $data['edit_data3']=$this->marketing_model->fetch_where_data_edit1($table,$where); // $val=$data['edit_data3']->subOrderID; // $where_con=array('subOrderID'=>$data['val']); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where); $res3=$this->marketing_model->fetch_edit_data_update5($where); $ress=$res3->foreignValue; $where1=$data['edit_data2']->exRate; $data['res4']= $ress * $where1; // print_r($data['res4']); // die(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); //$data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['shadeNo'] = $this->marketing_model->get_shadeNo2($w,'0'); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $data['indent_p']='indent_preview'; $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/sam_update', $data); $this->load->view('templates/footer_inside'); } public function sam_transaction_edit_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "=") + 1); $table='sub_orders'; //$data['generated_value']=array('id'=>$val); $where=array('id'=>$data['val'] ); $data['edit_data1']=$this->marketing_model->fetch_where_data_edit($table,$where); $w=$data['edit_data1']->orderID; //print_r($data['edit_data1']); //die(); $table='orders'; $where=array('id'=>$w); $data['edit_data2']=$this->marketing_model->fetch_where_data_edit($table,$where); $d = $data['edit_data2']->orderDate ; // Pull your date from the db $date = new DateTime($d); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $dd = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($dd); $data['deliveryDate_day'] = $date->format('d') ; // Creates date number $data['deliveryDate_month'] = $date->format('m'); // Creates month number $data['deliveryDate_year'] = $date->format('Y'); $lc_date = $data['edit_data2']->lcDate ; // Pull your date from the db $date = new DateTime($lc_date); $data['lc_day'] = $date->format('d') ; // Creates date number $data['lc_month'] = $date->format('m'); // Creates month number $data['lc_year'] = $date->format('Y'); $deliver_date = $data['edit_data2']->expiryDate ; // Pull your date from the db $date = new DateTime($deliver_date); $data['expiry_day'] = $date->format('d') ; // Creates date number $data['expiry_month'] = $date->format('m'); // Creates month number $data['expiry_year'] = $date->format('Y'); $delivery_date = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($delivery_date); $data['deliver_day'] = $date->format('d') ; // Creates date number $data['deliver_month'] = $date->format('m'); // Creates month number $data['deliver_year'] = $date->format('Y'); $validityDate = $data['edit_data2']->validityDate ; // Pull your date from the db $date = new DateTime($validityDate); $data['validityDate_day'] = $date->format('d') ; // Creates date number $data['validityDate_month'] = $date->format('m'); // Creates month number $data['validityDate_year'] = $date->format('Y'); //validityDate $table='sub_order_shades'; $where=array('subOrderID'=>$data['val'] ); $data['edit_data3']=$this->marketing_model->fetch_where_data_edit1($table,$where); // $val=$data['edit_data3']->subOrderID; // $where_con=array('subOrderID'=>$data['val']); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where); $res3=$this->marketing_model->fetch_edit_data_update5($where); $ress=$res3->foreignValue; $where1=$data['edit_data2']->exRate; $data['res4']= $ress * $where1; // print_r($data['res4']); // die(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); //$data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['shadeNo'] = $this->marketing_model->get_shadeNo2($w,'0'); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['indent_p']='today_preview'; $this->load->view('templates/header_inside',$data); $this->load->view('marketing/sam_update', $data); $this->load->view('templates/footer_inside'); } public function sam_edit_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "=") + 1); $table='sub_orders'; //$data['generated_value']=array('id'=>$val); $where=array('id'=>$data['val'] ); $data['edit_data1']=$this->marketing_model->fetch_where_data_edit($table,$where); $w=$data['edit_data1']->orderID; //print_r($data['edit_data1']); //die(); $table='orders'; $where=array('id'=>$w); $data['edit_data2']=$this->marketing_model->fetch_where_data_edit($table,$where); $d = $data['edit_data2']->orderDate ; // Pull your date from the db $date = new DateTime($d); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $dd = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($dd); $data['deliveryDate_day'] = $date->format('d') ; // Creates date number $data['deliveryDate_month'] = $date->format('m'); // Creates month number $data['deliveryDate_year'] = $date->format('Y'); $lc_date = $data['edit_data2']->lcDate ; // Pull your date from the db $date = new DateTime($lc_date); $data['lc_day'] = $date->format('d') ; // Creates date number $data['lc_month'] = $date->format('m'); // Creates month number $data['lc_year'] = $date->format('Y'); $deliver_date = $data['edit_data2']->expiryDate ; // Pull your date from the db $date = new DateTime($deliver_date); $data['expiry_day'] = $date->format('d') ; // Creates date number $data['expiry_month'] = $date->format('m'); // Creates month number $data['expiry_year'] = $date->format('Y'); $delivery_date = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($delivery_date); $data['deliver_day'] = $date->format('d') ; // Creates date number $data['deliver_month'] = $date->format('m'); // Creates month number $data['deliver_year'] = $date->format('Y'); $validityDate = $data['edit_data2']->validityDate ; // Pull your date from the db $date = new DateTime($validityDate); $data['validityDate_day'] = $date->format('d') ; // Creates date number $data['validityDate_month'] = $date->format('m'); // Creates month number $data['validityDate_year'] = $date->format('Y'); //validityDate $table='sub_order_shades'; $where=array('subOrderID'=>$data['val'] ); $data['edit_data3']=$this->marketing_model->fetch_where_data_edit1($table,$where); // $val=$data['edit_data3']->subOrderID; // $where_con=array('subOrderID'=>$data['val']); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where); $res3=$this->marketing_model->fetch_edit_data_update5($where); $ress=$res3->foreignValue; $where1=$data['edit_data2']->exRate; $data['res4']= $ress * $where1; // print_r($data['res4']); // die(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); //$data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['shadeNo'] = $this->marketing_model->get_shadeNo2($w,'0'); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['indent_p']='monthly_preview'; $this->load->view('templates/header_inside',$data); $this->load->view('marketing/sam_update', $data); $this->load->view('templates/footer_inside'); } public function sam_stk_edit_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "=") + 1); $table='sub_orders'; //$data['generated_value']=array('id'=>$val); $where=array('id'=>$data['val'] ); $data['edit_data1']=$this->marketing_model->fetch_where_data_edit($table,$where); $w=$data['edit_data1']->orderID; //print_r($data['edit_data1']); //die(); $table='orders'; $where=array('id'=>$w); $data['edit_data2']=$this->marketing_model->fetch_where_data_edit($table,$where); $d = $data['edit_data2']->orderDate ; // Pull your date from the db $date = new DateTime($d); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $dd = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($dd); $data['deliveryDate_day'] = $date->format('d') ; // Creates date number $data['deliveryDate_month'] = $date->format('m'); // Creates month number $data['deliveryDate_year'] = $date->format('Y'); $lc_date = $data['edit_data2']->lcDate ; // Pull your date from the db $date = new DateTime($lc_date); $data['lc_day'] = $date->format('d') ; // Creates date number $data['lc_month'] = $date->format('m'); // Creates month number $data['lc_year'] = $date->format('Y'); $deliver_date = $data['edit_data2']->expiryDate ; // Pull your date from the db $date = new DateTime($deliver_date); $data['expiry_day'] = $date->format('d') ; // Creates date number $data['expiry_month'] = $date->format('m'); // Creates month number $data['expiry_year'] = $date->format('Y'); $delivery_date = $data['edit_data2']->deliveryDate ; // Pull your date from the db $date = new DateTime($delivery_date); $data['deliver_day'] = $date->format('d') ; // Creates date number $data['deliver_month'] = $date->format('m'); // Creates month number $data['deliver_year'] = $date->format('Y'); $validityDate = $data['edit_data2']->validityDate ; // Pull your date from the db $date = new DateTime($validityDate); $data['validityDate_day'] = $date->format('d') ; // Creates date number $data['validityDate_month'] = $date->format('m'); // Creates month number $data['validityDate_year'] = $date->format('Y'); //validityDate $table='sub_order_shades'; $where=array('subOrderID'=>$data['val'] ); $data['edit_data3']=$this->marketing_model->fetch_where_data_edit1($table,$where); // $val=$data['edit_data3']->subOrderID; // $where_con=array('subOrderID'=>$data['val']); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where); $res3=$this->marketing_model->fetch_edit_data_update5($where); $ress=$res3->foreignValue; $where1=$data['edit_data2']->exRate; $data['res4']= $ress * $where1; // print_r($data['res4']); // die(); $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['getalltd'] = $this->marketing_model->display_transaction_data(); $data['designdata'] = $this->marketing_model->display_design_data(); $data['userdetails'] = $this->session_data_pass(); $data['orderTypes'] = $this->marketing_model->getOrderTypes(); $data['articles'] = $this->marketing_model->display_article_data(); //$data['articles'] = $this->marketing_model->display_article_data(); $data['outsource'] = $this->request_model->display_product_data(); $data['shadeNo'] = $this->marketing_model->get_shadeNo2($w,'0'); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['indent_p']='year_preview'; $this->load->view('templates/header_inside',$data); $this->load->view('marketing/sam_update', $data); $this->load->view('templates/footer_inside'); } public function update_sam_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $val=$this->input->post('val'); $where=array('id'=>$val); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $where=array('id'=>$max_order_id); $table='orders'; $data['max_order1']=$this->marketing_model->fetch_main_data($table,$where); $transaction_data = array( 'oslNo' => $this->input->post('oslNo'), 'fileNo' => $this->input->post('fileNo'), 'file_type' => $this->input->post('qbweights'), 'orderMode' => $this->input->post('orderMode'), 'orderNo' => $this->input->post('orderNo'), 'partyRef' => $this->input->post('partyName'), 'orderDate' => date('y-m-d', strtotime(str_replace('/', '-', $this->input->post('orderDate')))), 'deliveryDate' => date('y-m-d', strtotime(str_replace('/', '-', $this->input->post('deliveryDate')))), 'preview1'=>'preview', 'preview2'=>'preview', 'preview3'=>'preview', 'customerComments' => $this->input->post('customerComments'), ); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $arti1=$this->input->post('articleNo1'); $arti2=$this->input->post('articleNo2'); if(empty($arti1)) { $articleNo=$this->input->post('articleNo2'); } else { $articleNo=$this->input->post('articleNo1'); } $subCodeData = array( 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'articleNo' => $articleNo, 'article_type' => $this->input->post('article_type'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('design'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'created_by' => $approved_by, 'created_date' => date("d-m-Y") ); $shadeID= $this->input->post('shadeID'); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); $where=array('id'=>$val); $c=$this->marketing_model->fetch_edit_data($where); $sub_id1=$c->orderID; $where=array('id'=>$sub_id1); $this->db->where($where); $table='orders'; $this->db->update($table,$transaction_data); $condition=array('orderID'=>$sub_id1); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $gen=$generated_subcode->subCode + 1; $subcode_fun=array('subCode'=>$gen); // print_r($generated_subcode); $sub_id2=$c->id; $where=array('id'=>$sub_id2); $this->db->where($where); $table='sub_orders'; $this->db->update($table,$subCodeData); $sub_id=$c->id; $table='sub_order_shades'; $where=array('subOrderID'=>$sub_id); //$cc=$this->marketing_model->fetch_edit_data_update($where); $this->marketing_model->delete($table,$where); foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'subOrderID'=>$sub_id, ); $table='sub_order_shades'; $this->db->insert($table,$data); } } public function sam_sdk_orderinput() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table='sub_orders'; $where=array('orderID'=>$preview1); $data['fetch_preview2']=$this->marketing_model->input_preview($preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table,$where); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='indent_preview'; $this->load->view('marketing/sam_sdk_order_input_preview',$data); } public function sam_sdk_order_input() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table='sub_orders'; $where=array('orderID'=>$preview1); $data['fetch_preview2']=$this->marketing_model->input_preview($preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table,$where); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='today_preview'; $this->load->view('marketing/sam_sdk_order_input_preview',$data); } public function sam_sdk_orderinput_preview() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table='sub_orders'; $where=array('orderID'=>$preview1); $data['fetch_preview2']=$this->marketing_model->input_preview($preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table,$where); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='monthly_preview'; $this->load->view('marketing/sam_sdk_order_input_preview',$data); } public function sam_sdk_orderinput_view() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table='sub_orders'; $where=array('orderID'=>$preview1); $data['fetch_preview2']=$this->marketing_model->input_preview($preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table,$where); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='year_preview'; $this->load->view('marketing/sam_sdk_order_input_preview',$data); } public function insert_sam_generated_form() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); // $id=$this->marketing_model->max_select(); // $q=$id->id; $gen_val=$this->input->post('gen_val'); $where=array('id'=>$gen_val); $table='sub_orders'; $max_order=$this->marketing_model->fetch_main_data($table,$where); $max_order_id=$max_order->orderID; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_by=$id['username']; $subCodeData = array( 'orderID'=>$max_order_id, 'subCode' => $this->input->post('subCode'), 'subOrderType' => $this->input->post('subOrderType'), 'unit' => $this->input->post('unit'), 'articleNo' => $this->input->post('articleNo'), 'article_type' => $this->input->post('article_type'), 'design' => $this->input->post('dbdesign'), 'quality' => $this->input->post('quality'), 'width' => $this->input->post('width'), 'weave' => $this->input->post('design'), 'delete' => 'delete', 'edit' => 'edit', 'description' => $this->input->post('description'), 'created_by' => $approved_by, 'created_date' => date("d-m-Y") ); $table="sub_orders"; $this->marketing_model->insert($table,$subCodeData); $ourShade= $this->input->post('ourShade'); $buyerShade=$this->input->post('buyerShade'); $quantity= $this->input->post('quantity'); //$table="sub_orders"; //$this->marketing_model->insert($table,$transaction_data); $id=$this->marketing_model->max_select_suborders(); $q=$id->id; foreach($ourShade as $key=>$val) { //echo 'hai'; // $v=$val->shadeID; $data=array('ourShade'=>$ourShade[$key], 'buyerShade'=>$buyerShade[$key], 'quantity'=>$quantity[$key], 'subOrderID'=>$q, ); $table='sub_order_shades'; $this->db->insert($table,$data); } $condition=array('orderID'=>$max_order_id); $generated_subcode=$this->marketing_model->max_select_subcode($condition); $gen=$generated_subcode->subCode + 1; $subcode_fun=array('subCode'=>$gen); echo json_encode($subcode_fun); } public function get_sam_shade_id() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$_REQUEST['id']; //$exRate=$_REQUEST['exRate']; $table='sub_order_shades'; $where=array('shadeID'=>$id); $res=$this->marketing_model->fetch_edit_data1($where); $val=$res->subOrderID; $this->marketing_model->delete($table,$where); $where_con=array('subOrderID'=>$val); $data['res1']=$this->marketing_model->fetch_edit_data_update4($where_con); $data['res2']=$this->marketing_model->fetch_edit_data_update5($where_con); $res3=$this->marketing_model->fetch_edit_data_update5($where_con); $ress=$res3->foreignValue; //$where1=$data['edit_data2']->exRate; //$data['res4']= $ress * $exRate; echo json_encode($data); } public function box_master_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->session->userdata('logged_in'); $approved_by=$id['username']; $current_date = date("d-m-Y"); $length_cm = $this->input->post('length'); $width_cm = $this->input->post('width'); $height_cm = $this->input->post('height'); $dim = $length_cm . " X " . $width_cm . " X " . $height_cm ; $data=array('box_name' =>$this->input->post('box_name'), 'unique_no' =>$this->input->post('box_name'), 'length_cm' =>$this->input->post('length'), 'width_cm' =>$this->input->post('width'), 'height_cm' =>$this->input->post('height'), 'box_dimention' => $dim, 'total_cmb' =>$this->input->post('cmb'), 'box_wt' =>$this->input->post('box_wt'), 'created_by'=>$approved_by, 'created_date'=>$current_date ); $table='box_master'; $insert_id=$this->design_weaving_model->insert_data($table,$data); $table='box_master'; $max_id=$this->marketing_model->fetch_uniqueno($table); if(empty($max_id)) { $max_uni=1; } else { $max_uni=$max_id->unique_no + 1; } echo json_encode($max_uni); } public function box_master_grid_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $table='box_master'; $where=array('status'=>0); $detail=$this->marketing_model->fetch_where_data_desc($table,$where); echo json_encode($detail); } public function box_delete_fun() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->input->post('as'); $where=array('id'=>$id); $table='box_master'; $this->vendor_model->delete_vendor($table,$where); return true; } public function edit_box_master() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='box_master'; $where=array('id'=>$val); $data['fetch_data']=$this->vendor_model->get_customerdata($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/edit_box_master',$data); $this->load->view('templates/footer_inside'); } public function update_box_master_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $idd=$this->session->userdata('logged_in'); $where=array('id'=>$idd); $data['approved_by']=$idd['username']; $d=date('d-m-Y'); $data=array('box_name' =>$this->input->post('box_name'), 'box_size' =>$this->input->post('box_size'), 'box_capacity' =>$this->input->post('box_cap'), 'box_wt' =>$this->input->post('box_wt'), 'updated_by'=>$data['approved_by'], 'updated_on'=>$d ); $b_id=$this->input->post('box_id'); $where=array('id'=>$b_id); $table='box_master'; $insert_id=$this->marketing_model->update_data($where,$table,$data); } //////////////////// 1-6-2018 //////////////////////// public function transaction_details() { $this->db->from('marketing_delivery_date'); $this->db->truncate(); $this->db->truncate('marketing_delivery_date'); $from_date=$this->input->post('from_required_on'); $to_date=$this->input->post('to_required_on'); // $from_date = $_GET['from_date']; if($from_date != "") { $date = new DateTime($from_date); $from_date = $date->format('Y-m-d'); } if($to_date != "") { $date = new DateTime($to_date); $to_date = $date->format('Y-m-d'); } $data=array('from_date'=>$from_date, 'to_date'=>$to_date); // print_r($data); // die(); $table='marketing_delivery_date'; $this->db->insert($table,$data); } public function delivery_date_transaction_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $access_menu_id=$this->access_details_id(); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/delivery_date_marketing_details',$data); $this->load->view('templates/footer_inside'); } public function delivery_date_fetch_getorder_details() { $table='marketing_delivery_date'; $where=array('status'=>0); $m=$this->marketing_model->fetch_main_data($table,$where); // $table='orders'; // $where=array('deliveryDate >= '=>$m->from_date And 'deliveryDate <= '=>$m->to_date); $y=$m->from_date; $y1=$m->to_date; // print_r($y); // print_r('--------------'); // print_r($y1); // die(); $getalldata = $this->marketing_model->OSL_delivery_date_getorder($y,$y1); echo json_encode($getalldata); } public function madeups_box_master_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val'] = substr($uri, strpos($uri, "/") + 12); // print_r($data['val']); //die(); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; //<!----add from-------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_id=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_id); $dept_id_row=$this->vendor_model->get_where_row($table,$where); $user_type_id_row=$dept_id_row->user_type_id; //----------tiill-------------------- $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $check=""; foreach($m_id as $menu_id) { $table='swansilk_menu'; $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); $result= $this->marketing_model->fetch_main_data($table,$where); if(!empty($result->reference_url)){ if($result->reference_url == $data['val']) { $check=$data['val']; } } } if($check != "") { //<!----add from -------------> $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $data1=array(); foreach($m_id as $menu_id) { $table='access_action_rights'; $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); $arr=$this->vendor_model->get_where_row($table,$where); if(empty($arr)) { } else { //print_r($arr); $menu_id=$arr->menu_id; $table='swansilk_menu'; $where=array('menu_id'=>$menu_id); $url=$this->vendor_model->get_where_row($table,$where); if(!empty($url->reference_url)){ if($url->reference_url == $data['val']) { $data['access_row']=$arr; } } } } //----------tiill-------------------- $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['access'] = $this->access_details(); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/madeups_box_master_details', $data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function madeups_box_master_grid_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $table='madeups_box_master'; $where=array('status'=>0); $detail=$this->marketing_model->fetch_where_data_desc($table,$where); echo json_encode($detail); } public function view_madeups_box_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $table='madeups_box_master'; $max_id=$this->marketing_model->fetch_uniqueno($table); if(empty($max_id)) { $data['max_uni']=1; } else { $data['max_uni']=$max_id->unique_no + 1; } $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['access'] = $this->access_details(); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/madeups_box_master_view', $data); $this->load->view('templates/footer_inside'); } public function madeups_box_master_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->session->userdata('logged_in'); $approved_by=$id['username']; $current_date = date("d-m-Y"); $length_cm = $this->input->post('length'); $width_cm = $this->input->post('width'); $height_cm = $this->input->post('height'); $dim = $length_cm . " X " . $width_cm . " X " . $height_cm ; $data=array('box_name' =>$this->input->post('box_name'), 'unique_no' =>$this->input->post('box_name'), 'length_cm' =>$this->input->post('length'), 'width_cm' =>$this->input->post('width'), 'height_cm' =>$this->input->post('height'), 'total_cmb' =>$this->input->post('cmb'), 'box_wt' =>$this->input->post('box_wt'), 'box_dimention' => $dim, 'created_by'=>$approved_by, 'created_date'=>$current_date ); $table='madeups_box_master'; $insert_id=$this->design_weaving_model->insert_data($table,$data); $table='madeups_box_master'; $max_id=$this->marketing_model->fetch_uniqueno($table); if(empty($max_id)) { $max_uni=1; } else { $max_uni=$max_id->unique_no + 1; } echo json_encode($max_uni); } public function madeups_box_delete_fun() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->input->post('as'); $where=array('id'=>$id); $table='madeups_box_master'; $this->vendor_model->delete_vendor($table,$where); return true; } public function madeups_edit_box_master() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='madeups_box_master'; $where=array('id'=>$val); $data['fetch_data']=$this->vendor_model->get_customerdata($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/madeups_edit_box_master',$data); $this->load->view('templates/footer_inside'); } public function update_madeups_box_master_data() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $idd=$this->session->userdata('logged_in'); $where=array('id'=>$idd); $data['approved_by']=$idd['username']; $d=date('d-m-Y'); $data=array('length_cm' =>$this->input->post('length'), 'width_cm' =>$this->input->post('width'), 'height_cm' =>$this->input->post('height'), 'total_cmb' =>$this->input->post('cmb'), 'box_wt' =>$this->input->post('box_wt'), 'updated_by'=>$data['approved_by'], 'updated_on'=>$d ); $b_id=$this->input->post('box_id'); $where=array('id'=>$b_id); $table='madeups_box_master'; $insert_id=$this->marketing_model->update_data($where,$table,$data); } public function preview_customer_master_details($orderID = "") { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $where1=array('id'=>$orderID); $table1='customer_master'; $data['result']=$this->marketing_model->fetch_main_data($table1,$where1); $res=$data['result']->country; $where2=array('id'=>$res); $table2='country'; $data['res1']=$this->marketing_model->fetch_main_data($table2,$where2); $res_date=$data['result']->agencyFromDate; $date = new DateTime($res_date); $data['day'] = $date->format('d') ; // Creates date number $data['month'] = $date->format('m'); // Creates month number $data['year'] = $date->format('Y'); $data['res_country']=$data['res1']->country; $data['getalldata'] = $this->marketing_model->display_customer_data(); $data['country'] = $this->yarn_model->getcountries(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $res=$data['result']->country; $where2=array('id'=>$res); $table2='country'; $data['res1']=$this->marketing_model->fetch_main_data($table2,$where2); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['access'] = $this->access_details(); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/preview_customer_details', $data); $this->load->view('templates/footer_inside'); } public function preview_product_details($orderID = "") { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $where1=array('productID'=>$orderID); $table1='product_master'; $data['result']=$this->marketing_model->fetch_main_data($table1,$where1); // print_r($data['result']); // die(); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); $this->load->view('marketing/preview_product_details',$data); $this->load->view('templates/footer_inside'); } public function change_date() { $id=$this->input->post('ref_id'); $d=$this->input->post('del_date'); $del_date=date("Y-m-d", strtotime($d)); $d1=$this->input->post('change_ship_start_date'); $ship_start_date = date("Y-m-d", strtotime($d1)); $d2 = $this->input->post('change_ship_end_date'); $ship_end_date = date("Y-m-d", strtotime($d2)); $where=array('id'=>$id); $data=array('deliveryDate'=>$del_date,'ship_window_start'=>$ship_start_date,'ship_window_end'=>$ship_end_date); $table='orders'; $this->vendor_model->update_data($where,$table,$data); $res=1; echo json_encode($res); } public function fetch_change_date_id() { $id=$this->input->post('as'); $where=array('id'=>$id); $table='orders'; $res=$this->vendor_model->fetch_where_subgrid_data($table,$where); $val['del_date'] =date("d-m-Y", strtotime($res->deliveryDate)); $val['ship_window_start'] = date("d-m-Y", strtotime($res->ship_window_start)); $val['ship_window_end'] = date("d-m-Y", strtotime($res->ship_window_end)); echo json_encode($val); } //////////////////////// 28-12-2018 /////////////////////////// public function current_month_list() { $table='sub_orders'; $where=array('subOrderType'=>'FABRIC','orders_Type'=>' '); $order_typesd=$this->vendor_model->get_where_dataa($table,$where); if(empty($order_typesd)) { } else { foreach($order_typesd as $t) { $table='sub_orders'; $where=array('id'=>$t->id); $update_data=array('orders_Type'=>'FABRIC'); $this->vendor_model->update_data($where,$table,$update_data); } } $table='sub_orders'; $where=array('subOrderType !='=>'FABRIC','orders_Type'=>' '); $order_types_madeups=$this->vendor_model->get_where_dataa($table,$where); if(empty($order_types_madeups)) { } else { foreach($order_types_madeups as $tt) { $table='sub_orders'; $where=array('id'=>$tt->id); $update_data=array('orders_Type'=>'MADEUPS'); $this->vendor_model->update_data($where,$table,$update_data); } } $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $RT = substr($uri, strpos($uri, "/") + 12);; // echo $uri; // echo $RT; // die(); if($RT == 'marketing/current_month_list') { $data['url_val']='1'; $data['val']='marketing/current_month_list'; $data['ref']='indent'; } else if($RT == 'marketing/transactions_order_details?prop_id=2') { $data['val']='marketing/transactions_order_details?prop_id=1'; $data['url_val']='2'; $data['ref']='today_dashboard'; } else if($RT == 'marketing/transactions_order_details?prop_id=3') { $data['url_val']='3'; $data['val']='marketing/transactions_order_details?prop_id=1'; $data['ref']='month_dashboard'; } else if($RT == 'marketing/transactions_order_details?prop_id=4') { $data['url_val']='4'; $data['val']='marketing/transactions_order_details?prop_id=1'; $data['ref']='year_dashboard'; } $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; //<!----add from-------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_id=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_id); $dept_id_row=$this->vendor_model->get_where_row($table,$where); $user_type_id_row=$dept_id_row->user_type_id; //----------tiill-------------------- $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); // print_r($m_id); $check=""; foreach($m_id as $menu_id) { $table='swansilk_menu'; $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); $result= $this->marketing_model->fetch_main_data($table,$where); if($result->reference_url == $data['val']) { $check=$data['val']; } } if($check != "") { //<!----add from -------------> $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $data1=array(); foreach($m_id as $menu_id) { $table='access_action_rights'; $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); $arr=$this->vendor_model->get_where_row($table,$where); if(empty($arr)) { } else { //print_r($arr); $menu_id=$arr->menu_id; $table='swansilk_menu'; $where=array('menu_id'=>$menu_id); $url=$this->vendor_model->get_where_row($table,$where); if(!empty($url->reference_url)){ if($url->reference_url == $data['val']) { $data['access_row']=$arr; } } } } //----------tiill-------------------- $data['getalldata'] = $this->marketing_model->display_transaction_data(); //echo '<pre>';print_R($data['getalldata']);exit; $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $data['usertype']=$id['usertype']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['access'] = $this->access_details(); $this->load->view('templates/header_inside',$data); $this->load->view('yarn_master/current_month_delivery_list', $data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function get_month_wise_osl_delivery_list() { $get = $this->uri->segment(3); $gett = $this->uri->segment(4); preg_match_all('/([0-9]+|[a-zA-Z]+)/',$get,$matches); foreach($matches as $m) { $data['get_months']=$m[1]; } $data['get_year']=$gett; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $RT = 'marketing/transactions_order_details?prop_id=1'; if($RT == 'marketing/transactions_order_details?prop_id=1') { $data['url_val']='1'; $data['val']='marketing/transactions_order_details?prop_id=1'; $data['ref']='indent'; } else if($RT == 'marketing/transactions_order_details?prop_id=2') { $data['val']='marketing/transactions_order_details?prop_id=1'; $data['url_val']='2'; $data['ref']='today_dashboard'; } else if($RT == 'marketing/transactions_order_details?prop_id=3') { $data['url_val']='3'; $data['val']='marketing/transactions_order_details?prop_id=1'; $data['ref']='month_dashboard'; } else if($RT == 'marketing/transactions_order_details?prop_id=4') { $data['url_val']='4'; $data['val']='marketing/transactions_order_details?prop_id=1'; $data['ref']='year_dashboard'; } $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; //<!----add from-------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_id=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_id); $dept_id_row=$this->vendor_model->get_where_row($table,$where); $user_type_id_row=$dept_id_row->user_type_id; //----------tiill-------------------- $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $check=""; foreach($m_id as $menu_id) { $table='swansilk_menu'; $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); $result= $this->marketing_model->fetch_main_data($table,$where); if('marketing/transactions_order_details?prop_id=1' == $data['val']) { $check=$data['val']; } } if($check != "") { //<!----add from -------------> $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $data1=array(); foreach($m_id as $menu_id) { $table='access_action_rights'; $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); $arr=$this->vendor_model->get_where_row($table,$where); if(empty($arr)) { } else { //print_r($arr); $menu_id=$arr->menu_id; $table='swansilk_menu'; $where=array('menu_id'=>$menu_id); $url=$this->vendor_model->get_where_row($table,$where); if(!empty($url->reference_url)){ if($url->reference_url == $data['val']) { $data['access_row']=$arr; } } } } //----------tiill-------------------- $data['getalldata'] = $this->marketing_model->display_transaction_data(); //echo '<pre>';print_R($data['getalldata']);exit; $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['access'] = $this->access_details(); $this->load->view('templates/header_inside',$data); $this->load->view('yarn_master/get_month_wise_osl_delivery_list', $data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function pending_current_month_list() { $table='sub_orders'; $where=array('subOrderType'=>'FABRIC','orders_Type'=>' '); $order_typesd=$this->vendor_model->get_where_dataa($table,$where); if(empty($order_typesd)) { } else { foreach($order_typesd as $t) { $table='sub_orders'; $where=array('id'=>$t->id); $update_data=array('orders_Type'=>'FABRIC'); $this->vendor_model->update_data($where,$table,$update_data); } } $table='sub_orders'; $where=array('subOrderType !='=>'FABRIC','orders_Type'=>' '); $order_types_madeups=$this->vendor_model->get_where_dataa($table,$where); if(empty($order_types_madeups)) { } else { foreach($order_types_madeups as $tt) { $table='sub_orders'; $where=array('id'=>$tt->id); $update_data=array('orders_Type'=>'MADEUPS'); $this->vendor_model->update_data($where,$table,$update_data); } } $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $RT = substr($uri, strpos($uri, "/") + 12);; //echo $RT; //die(); if($RT == 'marketing/pending_current_month_list') { $data['url_val']='1'; $data['val']='marketing/pending_current_month_list'; $data['ref']='indent'; } else if($RT == 'marketing/transactions_order_details?prop_id=2') { $data['val']='marketing/transactions_order_details?prop_id=1'; $data['url_val']='2'; $data['ref']='today_dashboard'; } else if($RT == 'marketing/transactions_order_details?prop_id=3') { $data['url_val']='3'; $data['val']='marketing/transactions_order_details?prop_id=1'; $data['ref']='month_dashboard'; } else if($RT == 'marketing/transactions_order_details?prop_id=4') { $data['url_val']='4'; $data['val']='marketing/transactions_order_details?prop_id=1'; $data['ref']='year_dashboard'; } $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; //<!----add from-------------> $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $approved_id=$id['userid']; $table='employee_details'; $where=array('id'=>$approved_id); $dept_id_row=$this->vendor_model->get_where_row($table,$where); $user_type_id_row=$dept_id_row->user_type_id; //----------tiill-------------------- $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $check=""; foreach($m_id as $menu_id) { $table='swansilk_menu'; $where=array('delete_status'=>'ACTIVE','menu_id'=>$menu_id); $result= $this->marketing_model->fetch_main_data($table,$where); if($result->reference_url == $data['val']) { $check=$data['val']; } } if($check != "") { //<!----add from -------------> $access_menu_id=$this->access_details_id(); $m_id=unserialize($access_menu_id->menu_id); $data1=array(); foreach($m_id as $menu_id) { $table='access_action_rights'; $where=array('menu_id'=>$menu_id,'department_id'=>$user_type_id_row); $arr=$this->vendor_model->get_where_row($table,$where); if(empty($arr)) { } else { //print_r($arr); $menu_id=$arr->menu_id; $table='swansilk_menu'; $where=array('menu_id'=>$menu_id); $url=$this->vendor_model->get_where_row($table,$where); if(!empty($url->reference_url)){ if($url->reference_url == $data['val']) { $data['access_row']=$arr; } } } } //----------tiill-------------------- $data['getalldata'] = $this->marketing_model->display_transaction_data(); //echo '<pre>';print_R($data['getalldata']);exit; $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $table='employee_details'; $data['user_list']=$this->vendor_model->fetch_where_data($table); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $data['usertype']=$id['usertype']; //$data['designation'] = $id['designation']; $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $data['access'] = $this->access_details(); $this->load->view('templates/header_inside',$data); $this->load->view('yarn_master/pending_current_month_delivery_list', $data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function dtl_shipment() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1 = ($data['fetch_preview1']->id); $table5 ='sub_orders'; $where5 = array('orderID'=>$preview1); $data['sub_orders'] = $this->marketing_model->fetch_main_data($table5,$where5); $data['fileNo'] = $data['fetch_preview1']->fileNo; $data['orders_Type'] = $data['sub_orders']->orders_Type; $data['orders_id'] = $val; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $RT = substr($uri, strpos($uri, "/") + 12); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); if($data['sub_orders']->orders_Type == 'Fabric' || $data['sub_orders']->orders_Type == 'FABRIC'){ $this->load->view('marketing/dtl_shipment',$data); } else if($data['sub_orders']->orders_Type == 'Madeups' || $data['sub_orders']->orders_Type == 'MADEUPS'){ $this->load->view('marketing/dtl_shipment_madeups',$data); } $this->load->view('templates/footer_inside'); // } // else // { // $this->session->sess_destroy(); // redirect(base_url()); // } //print_r( $data); // die(); } public function details_fetch1() { $cid=$this->uri->segment(3); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $po=$this->marketing_model->pooo($cid); // print_r($po); // die(); $table='fabric_inspection_details'; $details = $this->marketing_model->display_fabric_embroidryinspection($po); //print_r($details); echo json_encode($details); } public function details_fetch2() { $cid=$this->uri->segment(3); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $po=$this->marketing_model->addu($cid); // print_r($po); // die(); $table='fabric_inspection_details'; $details = $this->marketing_model->display_fabric_embroidryinspection1($po); //print_r($details); echo json_encode($details); } public function buyer() { $this->uri->segment(3); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val1'] = substr($uri, strpos($uri, "=") + 1); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1 = ($data['fetch_preview1']->id); $table5 ='sub_orders'; $where5 = array('orderID'=>$preview1); $data['sub_orders'] = $this->marketing_model->fetch_main_data($table5,$where5); $data['fileNo'] = $data['fetch_preview1']->fileNo; $data['orders_Type'] = $data['sub_orders']->orders_Type; $data['orders_id'] = $val; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $data['usertype']=$id['usertype']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $RT = substr($uri, strpos($uri, "/") + 12); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); if($data['sub_orders']->orders_Type == 'Fabric' || $data['sub_orders']->orders_Type == 'FABRIC'){ $this->load->view('marketing/buyer_fabric',$data); } else if($data['sub_orders']->orders_Type == 'Madeups' || $data['sub_orders']->orders_Type == 'MADEUPS'){ $this->load->view('marketing/buyer_fabric',$data); } $this->load->view('templates/footer_inside'); // } // else // { // $this->session->sess_destroy(); // redirect(base_url()); // } //print_r( $data); // die(); } public function selected_po() { $id = $this->input->post('id'); $table6 ='fabric_inspection_details'; $where6 = array('id'=>$id); $data['fabric_inspection_details'] = $this->marketing_model->fetch_main_data($table6,$where6); $selected_po = $data['fabric_inspection_details']->selected_po; if($selected_po == 0){ $table='fabric_inspection_details'; $where=array('id'=>$id); $data=array('selected_po'=>1); $this->marketing_model->update_data($where,$table,$data); echo json_encode('Added to list successfully...'); } else{ $table='fabric_inspection_details'; $where=array('id'=>$id); $data=array('selected_po'=>0); $this->marketing_model->update_data($where,$table,$data); echo json_encode('Removed from list successfully...'); } } public function customer() { $this->uri->segment(3); $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $data['val1'] = substr($uri, strpos($uri, "=") + 1); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1 = ($data['fetch_preview1']->id); $table5 ='sub_orders'; $where5 = array('orderID'=>$preview1); $data['sub_orders'] = $this->marketing_model->fetch_main_data($table5,$where5); $data['fileNo'] = $data['fetch_preview1']->fileNo; $data['orders_Type'] = $data['sub_orders']->orders_Type; $data['orders_id'] = $val; $table6 ='customer_master'; $where6 = array('customerID'=>$data['fetch_preview1']->fileNo); $data['customer_data'] = $this->marketing_model->fetch_main_data($table6,$where6); $data['customerName'] = $data['customer_data']->customerName; $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $data['usertype']=$id['usertype']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $RT = substr($uri, strpos($uri, "/") + 12); $data['userdetails'] = $this->session_data_pass(); $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $access_menu_id=$this->access_details_id(); $emp_row=$id['userid']; $table='chat_message'; $where=array('unread'=>'0','to_id'=>$emp_row); $data['chatting_count']=$this->vendor_model->count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where); $this->load->view('templates/header_inside',$data); if($data['sub_orders']->orders_Type == 'Fabric' || $data['sub_orders']->orders_Type == 'FABRIC'){ $this->load->view('marketing/dtl_fabric',$data); } else if($data['sub_orders']->orders_Type == 'Madeups' || $data['sub_orders']->orders_Type == 'MADEUPS'){ $this->load->view('marketing/dtl_fabric',$data); } $this->load->view('templates/footer_inside'); // } // else // { // $this->session->sess_destroy(); // redirect(base_url()); // } //print_r( $data); // die(); } public function fullorder_details() { $id=$this->session->userdata('logged_in'); $where=array('id'=>$id); $data['approved_by']=$id['username']; $emp_row=$id['userid']; $table='employee_details'; $where=array('id'=>$emp_row); $data['emp_details']=$this->vendor_model->get_customerdata($table,$where); $uri = $_SERVER["REQUEST_URI"]; $val = substr($uri, strpos($uri, "=") + 1); $table='orders'; $where=array('id'=>$val); $data['fetch_preview1']=$this->marketing_model->fetch_main_data($table,$where); $preview1=($data['fetch_preview1']->id); $table='sub_orders'; $where=array('orderID'=>$preview1); $data['fetch_preview2']=$this->marketing_model->preview_input_suborder($preview1); //$subid=$this->marketing_model->fetch_subid($preview1); // print_r($data['fetch_preview2']); // die(); $data['shades_preview2'] = $this->marketing_model->input_shades_input_suborder($preview1); $data['material4']=array(); foreach($data['fetch_preview2'] as $j){ $product_id = $j->product_id; // $width=$this->marketing_model->fetch_width_article($preview1); $data['currency'] = $this->marketing_model->fetch_currency($product_id); $product_type = $this->marketing_model->fetch_product_types($preview1); if($product_type=='FABRIC' || $product_type=='EMB FABRIC' || $product_type=='QUILT FABRIC') { $data['material'] = $this->marketing_model->fetch_materials($product_id); } else{ $data['material'] = $this->marketing_model->fetch_materials_madeups($product_id); } array_push($data['material4'],$data['material']); } $data['fetch_preview_unit']=$this->marketing_model->input_preview_input_suborder($preview1); //$data['fetch_preview21']=$this->marketing_model->input_preview_input_suborder($preview1); $data['fetch_main2']=$this->marketing_model->fetch_main_data($table,$where); $data['fetch_pre']=$this->marketing_model->pre($preview1); $custId=($data['fetch_preview1']->fileNo); $table2='customer_master'; $where2=array('customerId'=>$custId); $data['address']=$this->marketing_model->fetch_customer_data($custId); $data['indent_p']='indent_preview'; $this->load->view('debit_note/order_details',$data); } } ?>