EVOLUTION-NINJA
Edit File: Import.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Import 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('vendor_model'); date_default_timezone_set('asia/kolkata'); $this->load->helper('date'); } //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 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 access_details() { $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 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 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_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 access_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=$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; } //display customer details public function supplier_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); $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['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $data['getalldata']=$this->yarn_model->display_supplier_data(); $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('import_module/supplier_details',$data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } //display customer module //display customer module public function supplier_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); $data['country']=$this->yarn_model->getcountries(); if($this->input->post('submitsupmaster')) { $this->form_validation->set_rules('customertype', 'Supplier type', 'trim|required|xss_clean'); $this->form_validation->set_rules('customername', 'Supplier name', 'trim|required|xss_clean'); $this->form_validation->set_rules('importfileno', 'Supplier ID', 'trim|required|xss_clean'); $this->form_validation->set_rules('address', 'Address', 'trim|required|xss_clean'); $this->form_validation->set_rules('country', 'Country', 'trim|required|xss_clean'); $this->form_validation->set_rules('mobile', 'Mobile', 'trim|required|numeric|xss_clean'); $this->form_validation->set_rules('phone', 'Phone', 'trim|required|numeric|xss_clean'); $this->form_validation->set_rules('fax', 'Fax', 'trim|required||xss_clean'); $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|xss_clean'); $this->form_validation->set_rules('website', 'Website', 'trim|required|xss_clean'); $this->form_validation->set_rules('contactperson', 'Contact person', 'trim|required|xss_clean'); $this->form_validation->set_rules('bankername', 'Banker name', 'trim|required|xss_clean'); $this->form_validation->set_rules('bankeraddress', 'Banker address', 'trim|required|xss_clean'); $this->form_validation->set_rules('sincefrom', 'Since from', 'trim|required|callback_is_start_date_valid|xss_clean'); $this->form_validation->set_rules('purchasetype', 'Purchase type', 'trim|required|xss_clean'); $this->form_validation->set_rules('notes', 'Notes', 'trim|required|xss_clean'); if($this->form_validation->run() == FALSE) { $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('import_module/supplier_master',$data); $this->load->view('templates/footer_inside'); } else { $supplier_data = array('customer_type'=> $this->input->post('customertype'), 'customer_name' => $this->input->post('customername'), 'import_fileno' => $this->input->post('importfileno'), 'address' => $this->input->post('address'), 'country' => $this->input->post('country'), 'mobile' => $this->input->post('mobile'), 'phone' => $this->input->post('phone'), 'fax' => $this->input->post('fax'), 'email' => $this->input->post('email'), 'website' => $this->input->post('website'), 'contact_person' => $this->input->post('contactperson'), 'banker_name' => $this->input->post('bankername'), 'banker_address' => $this->input->post('bankeraddress'), 'since_from' => explode("/",$this->input->post('sincefrom'))[2].'-'.explode("/",$this->input->post('sincefrom'))[1].'-'.explode("/",$this->input->post('sincefrom'))[0], 'purchase_type' => $this->input->post('purchasetype'), 'notes' => $this->input->post('notes'), ); $supinsert=$this->yarn_model->supplier_insert($supplier_data); if($supinsert==1) { $this->session->set_flashdata('flash_message', 'Successfully inserted'); redirect(base_url().'import/supplier_details','refresh'); } else { echo "notinserted"; } } } else { $data['user_type_id'] = $this->access_id(); $data['total_indent_notifications'] = 0; // $this->indent_page_notifications();notifications']; $data['access'] = $this->access_details(); $data['getalldata']=$this->yarn_model->display_supplier_data(); $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('import_module/supplier_master',$data); $this->load->view('templates/footer_inside'); } } 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 (!preg_match($date_regex, $date)) { $this->form_validation->set_message('is_start_date_valid','Please enter date format : dd/m/Y'); return false; } else { return true; } } function deductquantity() { $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); $quality_selected=$this->input->post('quality'); $licensenor_selected=$this->input->post('licensenor'); $recievedquantity=$this->input->post('recievedquantity'); if ($quality_selected>$recievedquantity) { $this->form_validation->set_message('deductquantity','Please enter date format'); return false; } else { return true; } } public function edit_supplier_master($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); $data['country']=$this->yarn_model->getcountries(); $data['editdata']=$this->yarn_model->get_supplier_editdata($id); if($this->input->post('submitsupmaster')) { $this->form_validation->set_rules('customertype', 'Supplier type', 'trim|required|xss_clean'); $this->form_validation->set_rules('customername', 'Supplier name', 'trim|required|alpha|xss_clean'); $this->form_validation->set_rules('importfileno', 'Supplier ID', 'trim|required|xss_clean|alpha_numeric'); $this->form_validation->set_rules('address', 'Address', 'trim|required|xss_clean'); $this->form_validation->set_rules('country', 'Country', 'trim|required|xss_clean'); $this->form_validation->set_rules('mobile', 'Mobile', 'trim|required|numeric|xss_clean'); $this->form_validation->set_rules('phone', 'Phone', 'trim|required|numeric|xss_clean'); $this->form_validation->set_rules('fax', 'Fax', 'trim|required||xss_clean|alpha_numeric'); $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|xss_clean'); $this->form_validation->set_rules('website', 'Website', 'trim|required|xss_clean'); $this->form_validation->set_rules('contactperson', 'Contact person', 'trim|required|xss_clean'); $this->form_validation->set_rules('bankername', 'Banker name', 'trim|required|alpha_numeric|xss_clean'); $this->form_validation->set_rules('bankeraddress', 'Banker address', 'trim|required|alpha_numeric|xss_clean'); $this->form_validation->set_rules('sincefrom', 'Since from', 'trim|required|callback_is_start_date_valid|xss_clean'); $this->form_validation->set_rules('purchasetype', 'Purchase type', 'trim|required|xss_clean'); $this->form_validation->set_rules('notes', 'Notes', 'trim|required|xss_clean|alpha_numeric'); if($this->form_validation->run() == FALSE) { $data['user_type_id'] = $this->access_id(); $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('import_module/edit_supplier_master',$data); $this->load->view('templates/footer_inside'); } else { $supplier_data = array('customer_type'=> $this->input->post('customertype'), 'customer_name' => $this->input->post('customername'), 'import_fileno' => $this->input->post('importfileno'), 'address' => $this->input->post('address'), 'country' => $this->input->post('country'), 'mobile' => $this->input->post('mobile'), 'phone' => $this->input->post('phone'), 'fax' => $this->input->post('fax'), 'email' => $this->input->post('email'), 'website' => $this->input->post('website'), 'contact_person' => $this->input->post('contactperson'), 'banker_name' => $this->input->post('bankername'), 'banker_address' => $this->input->post('bankeraddress'), 'since_from' => date('Y-m-d',strtotime($this->input->post('sincefrom'))), 'purchase_type' => $this->input->post('purchasetype'), 'notes' => $this->input->post('notes'), ); $supupdate=$this->yarn_model->supplier_update($supplier_data,$id); if($supupdate==1) { redirect(base_url().'import/supplier_details','refresh'); } } } else { $data['user_type_id'] = $this->access_id(); $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('import_module/edit_supplier_master',$data); $this->load->view('templates/footer_inside'); } } //display customer details public function advance_authorisation_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); $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->yarn_model->display_aa_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('import_module/advance_authorisation_details',$data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function edit_advanced_auth($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); $data['quality'] = $this->yarn_model->display_yarnQuality(); $data['editdata'] = $this->yarn_model->get_advanedauth_editdata($id); if ($this->input->post('submitaa')) { $this->form_validation->set_rules('licenceno', 'Licence no', 'trim|required|xss_clean|alpha_numeric'); $this->form_validation->set_rules('dates', 'Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('quality', 'Quality', 'trim|required|xss_clean'); $this->form_validation->set_rules('quantity', 'Quantity', 'trim|required|xss_clean'); $this->form_validation->set_rules('cifindoller', 'Cif in', 'trim|required|xss_clean'); $this->form_validation->set_rules('cifinrupee', 'Cif in rupee', 'trim|required|xss_clean'); $this->form_validation->set_rules('balancecifindollar', 'Balance cif in Dollar', 'trim|required|xss_clean'); $this->form_validation->set_rules('balancecifininr', 'Balance cif in INR', '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('import_module/edit_advanced_auth', $data); $this->load->view('templates/footer_inside'); } else { $auth_data = array('license_no' => $this->input->post('licenceno'), 'date' => explode("/",$this->input->post('dates'))[2].'-'.explode("/",$this->input->post('dates'))[1].'-'.explode("/",$this->input->post('dates'))[0], 'quality' => $this->input->post('quality'), 'quantity' => $this->input->post('quantity'), 'symbols' => $this->input->post('symbolcurrency'), 'cif_doller' => $this->input->post('cifindoller'), 'cif_rupee' => $this->input->post('cifinrupee'), 'balance_cif_dollar' => $this->input->post('balancecifindollar'), 'balance_cif_inr' => $this->input->post('balancecifininr'), ); $authdate = $this->yarn_model->advanced_auth_update($auth_data, $id); if ($authdate == 1) { redirect(base_url() . 'import/advance_authorisation_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('import_module/edit_advanced_auth', $data); $this->load->view('templates/footer_inside'); } } //display advanced authorisation form. public function advanced_auth() { $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['quality']=$this->yarn_model->display_yarnQuality(); if($this->input->post('submitaa')) { $this->form_validation->set_rules('licenceno', 'Licence no', 'trim|max_length[11]|required|xss_clean|alpha_numeric|callback_uniq_licencequality'); $this->form_validation->set_rules('dates', 'Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('quality', 'Quality', 'trim|required|xss_clean'); $this->form_validation->set_rules('quantity', 'Quantity', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('cifindoller', 'Cif in', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('cifinrupee', 'Cif in rupee', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('balancecifindollar', 'Balance cif in Dollar', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('balancecifininr', 'Balance cif in INR', '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('import_module/advance_authorisation',$data); $this->load->view('templates/footer_inside'); } else { $auth_data = array('license_no'=> $this->input->post('licenceno'), 'date' => explode("/",$this->input->post('dates'))[2].'-'.explode("/",$this->input->post('dates'))[1].'-'.explode("/",$this->input->post('dates'))[0], 'quality' => $this->input->post('quality'), 'quantity' => $this->input->post('quantity'), 'symbols' => $this->input->post('symbolcurrency'), 'cif_doller' =>$this->input->post('cifindoller'), 'cif_rupee' => $this->input->post('cifinrupee'), 'balanceQuantity' => $this->input->post('quantity'), 'balance_cif_dollar' => $this->input->post('balancecifindollar'), 'balance_cif_inr' => $this->input->post('balancecifininr'), ); $authinsert=$this->yarn_model->advance_auth_insert($auth_data); if($authinsert==1) { redirect(base_url().'import/advance_authorisation_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('import_module/advance_authorisation',$data); $this->load->view('templates/footer_inside'); } } //check when license number and quality combination is unique or not function uniq_licencequality() { $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); $licenceno=$this->input->post('licenceno'); $quality=$this->input->post('quality'); $result=$this->yarn_model->uniquelicensequality($licenceno, $quality); if(!$result) { return true; } else { $this->form_validation->set_message('uniq_licencequality','This License number and quality is already selected.'); return false; } } //check when license number and quality combination is unique or not function uniq_schemeno() { $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); $schemeno=$this->input->post('schemeno'); $result=$this->yarn_model->uniquescheemano($schemeno); if(!$result) { return true; } else { $this->form_validation->set_message('uniq_schemeno','Scheme number already exist.'); return false; } } //display incentive schema details public function incentive_schemes_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); $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->yarn_model->display_incntiveschema_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('import_module/incentive_schemes_details',$data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } //display incentive schema form. public function incentive_schemes() { $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('submitincentiveschema')) { $this->form_validation->set_rules('schemeno', 'Scheme no', 'trim|required|max_length[11]|xss_clean|alpha_numeric|callback_uniq_schemeno'); $this->form_validation->set_rules('datepicker', 'Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('dutycredit', 'Duty credit', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('balanceavailable', 'Balance available', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('reference', 'Reference', '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('import_module/incentive_schemes'); $this->load->view('templates/footer_inside'); } else { $incentive_data = array('scheme_no'=> $this->input->post('schemeno'), 'date' => explode("/",$this->input->post('datepicker'))[2].'-'.explode("/",$this->input->post('datepicker'))[1].'-'.explode("/",$this->input->post('datepicker'))[0], 'duty_credit' => $this->input->post('dutycredit'), 'balance_availaible' => $this->input->post('balanceavailable'), 'reference' => $this->input->post('reference') ); $incentiveinsert=$this->yarn_model->incentive_insert($incentive_data); if($incentiveinsert==1) { redirect(base_url().'import/incentive_schemes_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('import_module/incentive_schemes'); $this->load->view('templates/footer_inside'); } } public function edit_incentive_scheem($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); $data['editdata']=$this->yarn_model->get_incentive_editdata($id); if($this->input->post('submitincentiveschema')) { $this->form_validation->set_rules('schemeno', 'Scheme no', 'trim|required|xss_clean|alpha_numeric'); $this->form_validation->set_rules('datepicker', 'Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('dutycredit', 'Duty credit', 'trim|required|xss_clean'); $this->form_validation->set_rules('balanceavailable', 'Balance available', 'trim|required|xss_clean'); $this->form_validation->set_rules('reference', 'Reference', '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('import_module/edit_incentive_schemes'); $this->load->view('templates/footer_inside'); } else { $incentive_data = array('scheme_no'=> $this->input->post('schemeno'), 'date' => explode("/",$this->input->post('datepicker'))[2].'-'.explode("/",$this->input->post('datepicker'))[1].'-'.explode("/",$this->input->post('datepicker'))[0], 'duty_credit' => $this->input->post('dutycredit'), 'balance_availaible' => $this->input->post('balanceavailable'), 'reference' => $this->input->post('reference') ); $incupdate=$this->yarn_model->incentive_update($incentive_data,$id); if($incupdate==1) { redirect(base_url().'import/incentive_schemes_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('import_module/edit_incentive_schemes',$data); $this->load->view('templates/footer_inside'); } } public function masters_import_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); $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->yarn_model->display_mastermodule_data(); foreach($this->yarn_model->display_mastermodule_data() as $getrsult) { $data['getbookingdata']=$this->yarn_model->getbookingdata($getrsult->import_file_no); } $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('import_module/masters_import_details',$data); $this->load->view('templates/footer_inside'); } else { $this->session->sess_destroy(); redirect(base_url()); } } public function masters_import($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); $this->load->library('upload'); error_reporting(E_ALL ^ E_NOTICE); // Don't display errors (they can still be logged) ini_set('display_errors', 0); $data['bookingtype']=$this->yarn_model->display_mastermodule_data(); $data['getquality']=$this->yarn_model->display_yarnQuality(); $data['yarndenier']=$this->yarn_model->display_yarndenier(); $data['getfileno']=$this->yarn_model->display_supplier_data(); //new consignment add in edit start if($this->input->post('nextconsignment1')) { $importfilenor=$this->input->post('importfileno'); $this->session->set_flashdata('flash_message', $importfilenor); $this->session->set_flashdata('newidentification', "newadding"); redirect(base_url().'import/masters_import','refresh'); } else { //new consignment add in edit end if($this->input->post('submitmi') || $this->input->post('nextconsignment')) { $lastidInMasterImport=$this->yarn_model->masterimportLastID(); $this->form_validation->set_rules('importfileno', 'Import File No', 'trim|required|xss_clean'); //$this->form_validation->set_rules('consignmentno', 'Consignment No', 'trim|required|xss_clean'); $this->form_validation->set_rules('fileno', 'File No', 'trim|required|xss_clean'); $this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean'); $this->form_validation->set_rules('address', 'Address', 'trim|required|xss_clean'); $this->form_validation->set_rules('importtype', 'Import Type', 'trim|required|xss_clean'); $this->form_validation->set_rules('quality', 'Quality', 'trim|required|xss_clean'); $this->form_validation->set_rules('dinear', 'Dinear', 'trim|required|xss_clean'); $this->form_validation->set_rules('grade', 'Grade', 'trim|required|xss_clean'); $this->form_validation->set_rules('millno', 'Mill No', 'trim|required|xss_clean'); $this->form_validation->set_rules('bookingdate', 'Booking Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('bookingtype', 'Booking Type', 'trim|required|xss_clean'); $check_bookingdata=$this->yarn_model->check_booking_existed($this->input->post('importfileno'));//check one booking is already existed or not for one import file nor. $check_lcdata=$this->yarn_model->check_lc_existed($this->input->post('importfileno'));//check lc data is entered for one import file number or not. $check_goodsdata=$this->yarn_model->check_goods_existed($this->input->post('importfileno'));//check lc data is entered for one import file number or not. if(!$check_bookingdata) { $this->form_validation->set_rules('paymenttype', 'Payment Type', 'trim|required|xss_clean'); } $this->form_validation->set_rules('salescontractno', 'Sales Contract No', 'trim|required|xss_clean|alpha_numeric'); $this->form_validation->set_rules('quantitybooked', 'Quantity Booked', 'trim|required|xss_clean'); $this->form_validation->set_rules('boxnoofbale', 'Box No Of Bale', 'trim|required|xss_clean'); $this->form_validation->set_rules('unitprice', 'Unit Price', 'trim|required|xss_clean'); if($this->input->post('paymenttype')=="LC" && count($check_lcdata)==0) { $this->form_validation->set_rules('lcno', 'Lc No', 'trim|required|xss_clean'); $this->form_validation->set_rules('exchangerate', 'Exchange Rate', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('lcdate', 'Lc Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('lcvaluefcn', 'Lc Value Fcn', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('lcbankaddress', 'Lc Bank Address', 'trim|required|xss_clean'); $this->form_validation->set_rules('lcexpirydate', 'Lc Expiry Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('lcamend', 'Lcamend', 'trim|required|xss_clean'); } //$this->form_validation->set_rules('selectcategory[]', 'selectcategory', 'trim|required|xss_clean'); //$this->form_validation->set_rules('recieveddate', 'Recieved Date', 'trim|required|xss_clean'); //$this->form_validation->set_rules('noofbalebox', 'No Of Bale Box', 'trim|required|xss_clean'); //$this->form_validation->set_rules('recievedloation', 'recievedloation', 'trim|required|xss_clean'); //$this->form_validation->set_rules('transportcharges', 'transportcharges', 'trim|required|xss_clean'); if($this->input->post('licensenor')) { //$this->form_validation->set_rules('recievedquantity', 'Recieved Quantity', 'trim|callback_deductquantity|required|xss_clean'); } //$this->form_validation->set_rules('invoicenor', 'Invoice No', 'trim|required|xss_clean'); //$this->form_validation->set_rules('invoicedate', 'Invoice Date', 'trim|required|xss_clean'); //$this->form_validation->set_rules('docacceptdate', 'Doc Accept Date', 'trim|required|xss_clean'); //$this->form_validation->set_rules('referencenor', 'Reference No', 'trim|required|xss_clean'); //$this->form_validation->set_rules('bankcharges', 'Bank Charges', 'trim|required|xss_clean'); //$this->form_validation->set_rules('foreignbankcharge', 'Foreign Bank Charge', 'trim|required|xss_clean'); //$this->form_validation->set_rules('othercharges', 'Other Charges', 'trim|required|xss_clean'); //$this->form_validation->set_rules('candfcharges', 'C and F Charges', 'trim|required|xss_clean'); //$this->form_validation->set_rules('customduty', 'Custom Duty', 'trim|required|xss_clean'); //$this->form_validation->set_rules('insuranceamount', 'Insurance Amount', 'trim|required|xss_clean'); //$this->form_validation->set_rules('pandtcharges', 'P and T Charges', 'trim|required|xss_clean'); //$this->form_validation->set_rules('paymentdate', 'Payment Date', 'trim|required|xss_clean'); //$this->form_validation->set_rules('fcvalue', 'FC Value', 'trim|required|xss_clean'); //$this->form_validation->set_rules('exrate', 'Exrate', 'trim|required|xss_clean'); //$this->form_validation->set_rules('inrvalue', 'INR value', 'trim|required|xss_clean'); //$this->form_validation->set_rules('totalvalue', 'Total Value', 'trim|required|xss_clean'); //$this->form_validation->set_rules('averagerate', 'Average Rate', 'trim|required|xss_clean'); //$this->form_validation->set_rules('remarks', 'Remarks', 'trim|required|xss_clean'); if($this->input->post('billentryno') || $this->input->post('billentrydate') || $this->input->post('billloadingno') || $this->input->post('billloadingdate') || $this->input->post('port') || $this->input->post('eta')) { $this->form_validation->set_rules('billentryno', 'Bill Entry Number', 'trim|required|xss_clean'); $this->form_validation->set_rules('billentrydate', 'Bill Entry Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('billloadingno', 'Bill Loading Number', 'trim|required|xss_clean'); $this->form_validation->set_rules('billloadingdate', 'Bill Loading Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('port', 'Port', 'trim|required|xss_clean'); $this->form_validation->set_rules('eta', 'ETA', 'trim|required|xss_clean'); } if($this->form_validation->run() == FALSE) { //echo '<pre>';print_r($data);exit; $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('import_module/masters_import_dup',$data); $this->load->view('templates/footer_inside'); } else { //pdf file upload start if (!empty($_FILES['uploadpdffile']['name'])) { // Specify configuration for File 1 $config['upload_path'] = 'pdfuploads/'; $config['allowed_types'] = 'gif|jpg|png|pdf'; $config['max_size'] = '1000KB'; $config['max_width'] = '2024'; $config['max_height'] = '2768'; // Initialize config for File 1 $this->upload->initialize($config); // Upload file 1 if ($this->upload->do_upload('uploadpdffile')) { $data = $this->upload->data(); $file1=$data['file_name']; } else { echo $this->upload->display_errors(); exit; } } else //if user is not select the pdf file then it will insert empty value in db. { $file1=""; } //pdf file upload end if($this->input->post('editableid')) { $masters_data = array( 'import_file_no'=> $this->input->post('importfileno'), //'consignment_no' => $this->input->post('consignmentno'), 'file_no' => $this->input->post('fileno'), 'name' => $this->input->post('name'), 'address' => $this->input->post('address'), 'import_type' => $this->input->post('importtype'), 'pdf_file' => $file1, //'RecievedDate' => date('Y-m-d',strtotime(trim($this->input->post('recieveddate')))), 'NoofBaleBox' => $this->input->post('noofbalebox'), //'RecievedLocation' => $this->input->post('recievedloation'), //'TransportCharges' => $this->input->post('transportcharges'), 'InvoiceNo' => $this->input->post('invoicenor'), 'InvoiceDate' => date('Y-m-d',strtotime(trim($this->input->post('invoicedate')))), 'DocAcceptDate' => date('Y-m-d',strtotime(trim($this->input->post('docacceptdate')))), 'ReferenceNo' => $this->input->post('referencenor'), 'BankCharges' => $this->input->post('bankcharges'), 'ForeignBankCharge' => $this->input->post('foreignbankcharge'), 'OtherCharges' => $this->input->post('othercharges'), 'CandFCharges' => $this->input->post('candfcharges'), 'CustomDuty' => $this->input->post('customduty'), 'InsuranceAmount' => $this->input->post('insuranceamount'), 'PandTcharges' => $this->input->post('pandtcharges'), 'PaymentDate' => date('Y-m-d',strtotime(trim($this->input->post('paymentdate')))), 'FCvalue' => $this->input->post('fcvalue'), 'ExRate' => $this->input->post('exrate'), 'INRValue' => $this->input->post('inrvalue'), 'TotalValue' => $this->input->post('totalvalue'), 'AverageRate' => $this->input->post('averagerate'), 'Remarks' => $this->input->post('remarks'), //'category'=>$this->input->post('categories'), //'license_no'=>$this->input->post('licensenor'), //'recieved_quantity'=>$this->input->post('recievedquantity') ); } else{ $masters_data = array( 'import_file_no'=> $this->input->post('importfileno'), 'consignment_no' => $this->input->post('consignmentno'), 'file_no' => $this->input->post('fileno'), 'name' => $this->input->post('name'), 'address' => $this->input->post('address'), 'import_type' => $this->input->post('importtype'), 'pdf_file' => $file1, //'RecievedDate' => date('Y-m-d',strtotime(trim($this->input->post('recieveddate')))), 'NoofBaleBox' => $this->input->post('noofbalebox'), //'RecievedLocation' => $this->input->post('recievedloation'), //'TransportCharges' => $this->input->post('transportcharges'), 'InvoiceNo' => $this->input->post('invoicenor'), 'InvoiceDate' => date('Y-m-d',strtotime(trim($this->input->post('invoicedate')))), 'DocAcceptDate' => date('Y-m-d',strtotime(trim($this->input->post('docacceptdate')))), 'ReferenceNo' => $this->input->post('referencenor'), 'BankCharges' => $this->input->post('bankcharges'), 'ForeignBankCharge' => $this->input->post('foreignbankcharge'), 'OtherCharges' => $this->input->post('othercharges'), 'CandFCharges' => $this->input->post('candfcharges'), 'CustomDuty' => $this->input->post('customduty'), 'InsuranceAmount' => $this->input->post('insuranceamount'), 'PandTcharges' => $this->input->post('pandtcharges'), 'PaymentDate' => date('Y-m-d',strtotime(trim($this->input->post('paymentdate')))), 'FCvalue' => $this->input->post('fcvalue'), 'ExRate' => $this->input->post('exrate'), 'INRValue' => $this->input->post('inrvalue'), 'TotalValue' => $this->input->post('totalvalue'), 'AverageRate' => $this->input->post('averagerate'), 'Remarks' => $this->input->post('remarks'), //'category'=>$this->input->post('categories'), //'license_no'=>$this->input->post('licensenor'), //'recieved_quantity'=>$this->input->post('recievedquantity') ); } if($this->input->post('editableid')) { $booking_data=array( //'master_id' => $lastidInMasterImport->id+1, 'mi_id' => $this->input->post('importfileno'), 'quality' => $this->input->post('quality'), 'dinear' => $this->input->post('dinear'), 'grade' => $this->input->post('grade'), 'mill_no' => $this->input->post('millno'), 'booking_date' => explode("/",$this->input->post('bookingdate'))[2].'-'.explode("/",$this->input->post('bookingdate'))[1].'-'.explode("/",$this->input->post('bookingdate'))[0], 'booking_type' => $this->input->post('bookingtype'), 'payment_type' => $this->input->post('paymenttype'), 'sales_contract_no' => $this->input->post('salescontractno'), 'quantity_booked' => $this->input->post('qbweights').' '.$this->input->post('quantitybooked'), 'box_no_of_bale' => $this->input->post('boxnoofbale'), 'unit_price' => $this->input->post('symbolcurrency').' '.$this->input->post('unitprice'), ); } else { $booking_data=array( 'master_id' => $lastidInMasterImport->id+1, 'mi_id' => $this->input->post('importfileno'), 'quality' => $this->input->post('quality'), 'dinear' => $this->input->post('dinear'), 'grade' => $this->input->post('grade'), 'mill_no' => $this->input->post('millno'), 'booking_date' => explode("/",$this->input->post('bookingdate'))[2].'-'.explode("/",$this->input->post('bookingdate'))[1].'-'.explode("/",$this->input->post('bookingdate'))[0], 'booking_type' => $this->input->post('bookingtype'), 'payment_type' => $this->input->post('paymenttype'), 'sales_contract_no' => $this->input->post('salescontractno'), 'quantity_booked' => $this->input->post('qbweights').' '.$this->input->post('quantitybooked'), 'box_no_of_bale' => $this->input->post('boxnoofbale'), 'unit_price' => $this->input->post('symbolcurrency').' '.$this->input->post('unitprice'), ); } if($this->input->post('paymenttype')=="LC" && count($check_lcdata)==0) { $lc_data=array( 'master_id' => $lastidInMasterImport->id+1, 'mi_id' => $this->input->post('importfileno'), 'lc_no' => $this->input->post('lcno'), 'exchange_rate' => $this->input->post('exchangerate'), 'lc_date' => explode("/",$this->input->post('lcdate'))[2].'-'.explode("/",$this->input->post('lcdate'))[1].'-'.explode("/",$this->input->post('lcdate'))[0], 'lc_value_fcn' => $this->input->post('lcvaluefcn'), 'lc_bank_address' => $this->input->post('lcbankaddress'), 'lc_expiry_date' => explode("/",$this->input->post('lcexpirydate'))[2].'-'.explode("/",$this->input->post('lcexpirydate'))[1].'-'.explode("/",$this->input->post('lcexpirydate'))[0], 'lc_amend' => $this->input->post('lcamend'), ); } if($this->input->post('billentryno') && $this->input->post('billentrydate') && $this->input->post('billloadingno') && $this->input->post('billloadingdate') && $this->input->post('port') && $this->input->post('eta')) { $checkexist=mysql_query("SELECT * FROM mi_shippingDetails WHERE master_id='".$this->input->post('editableid')."'"); $cherw_shping=mysql_num_rows($checkexist); if($cherw_shping==1)//if shipping data is already existed then update here { $shipping_data=array( 'mi_id' => $this->input->post('importfileno'), 'billEntryNo' => $this->input->post('billentryno'), 'billEntryDate' => explode("/",$this->input->post('billentrydate'))[2].'-'.explode("/",$this->input->post('billentrydate'))[1].'-'.explode("/",$this->input->post('billentrydate'))[0], 'billLoadingNo' => $this->input->post('billloadingno'), 'billLoadingDate' => explode("/",$this->input->post('billloadingdate'))[2].'-'.explode("/",$this->input->post('billloadingdate'))[1].'-'.explode("/",$this->input->post('billloadingdate'))[0], 'port' => $this->input->post('port'), 'ETA' => explode("/",$this->input->post('eta'))[2].'-'.explode("/",$this->input->post('eta'))[1].'-'.explode("/",$this->input->post('eta'))[0], ); } else//if shipping data is not yet added then insert here { if($this->input->post('editableid')) { $final_masterid=$this->input->post('editableid'); } else { $final_masterid=$lastidInMasterImport->id+1; } $shipping_data=array( 'master_id' => $final_masterid, 'mi_id' => $this->input->post('importfileno'), 'billEntryNo' => $this->input->post('billentryno'), 'billEntryDate' => explode("/",$this->input->post('billentrydate'))[2].'-'.explode("/",$this->input->post('billentrydate'))[1].'-'.explode("/",$this->input->post('billentrydate'))[0], 'billLoadingNo' => $this->input->post('billloadingno'), 'billLoadingDate' => explode("/",$this->input->post('billloadingdate'))[2].'-'.explode("/",$this->input->post('billloadingdate'))[1].'-'.explode("/",$this->input->post('billloadingdate'))[0], 'port' => $this->input->post('port'), 'ETA' => explode("/",$this->input->post('eta'))[2].'-'.explode("/",$this->input->post('eta'))[1].'-'.explode("/",$this->input->post('eta'))[0], ); } } else { $shipping_data=""; } if($this->input->post('editableid')) { $chekkkk=mysql_query("SELECT * FROM mi_goodsDetails where master_id='".$this->input->post('editableid')."'"); $chekkrs=mysql_num_rows($chekkkk); if($chekkrs==1) { $getexid=mysql_fetch_array($chekkkk); $goodids=$getexid['id']; $goodsdetails_data=array( 'RecievedDate' => explode("/",$this->input->post('goodsrecieveddate'))[2].'-'.explode("/",$this->input->post('goodsrecieveddate'))[1].'-'.explode("/",$this->input->post('goodsrecieveddate'))[0], 'NoofBaleBox' => $this->input->post('noofbalebox'), ); $this->db->update('mi_goodsDetails', $goodsdetails_data, array('master_id' => $this->input->post('editableid'))); $delethis=mysql_query("DELETE FROM mi_goods_license_recieved WHERE goods_details_id='$goodids'"); if($delethis) { for ($i = 0; $i < count($this->input->post('selectcategory')); $i++) { $goodslr_data = array( 'category' => $this->input->post('selectcategory')[$i], 'goods_details_id' => $goodids, 'license_no' => $this->input->post('licensenor')[$i], 'recieved_quantity' => $this->input->post('recievedquantity')[$i], ); $this->db->insert('mi_goods_license_recieved',$goodslr_data); } } } } if($this->input->post('goodsrecieveddate') && $this->input->post('noofbalebox')) { $goodsdetails_data=array( 'master_id' => $lastidInMasterImport->id+1, 'mi_id' => $this->input->post('importfileno'), //'lic_no' => $this->input->post('licno'), //'rec_wt' => $this->input->post('recwt'), 'RecievedDate' => explode("/",$this->input->post('goodsrecieveddate'))[2].'-'.explode("/",$this->input->post('goodsrecieveddate'))[1].'-'.explode("/",$this->input->post('goodsrecieveddate'))[0], 'NoofBaleBox' => $this->input->post('noofbalebox'), //'RecievedLocation' => date('Y-m-d',strtotime(trim($this->input->post('recievedloation')))), //'TransportCharges' => $this->input->post('transportcharges'), //'category' => $this->input->post('categories'), ); } else { $goodsdetails_data=""; } //if($this->input->post('invoicenor') && $this->input->post('invoicedate') && $this->input->post('docacceptdate') && $this->input->post('referencenor') && $this->input->post('bankcharges') && $this->input->post('foreignbankcharge') //&& $this->input->post('othercharges') && $this->input->post('candfcharges') && $this->input->post('customduty') && $this->input->post('insuranceamount') //&& $this->input->post('pandtcharges') && $this->input->post('paymentdate') && $this->input->post('fcvalue') && $this->input->post('exrate') //&& $this->input->post('inrvalue') && $this->input->post('totalvalue') && $this->input->post('averagerate')) //{ if($this->input->post('editableid')) { $invoice_data=array( 'mi_id' => $this->input->post('importfileno'), 'InvoiceNo' => $this->input->post('invoicenor'), 'InvoiceDate' => explode("/",$this->input->post('invoicedate'))[2].'-'.explode("/",$this->input->post('invoicedate'))[1].'-'.explode("/",$this->input->post('invoicedate'))[0], 'DocAcceptDate' => explode("/",$this->input->post('docacceptdate'))[2].'-'.explode("/",$this->input->post('docacceptdate'))[1].'-'.explode("/",$this->input->post('docacceptdate'))[0], 'ReferenceNo' => $this->input->post('referencenor'), 'BankCharges' => $this->input->post('bankcharges'), 'ForeignBankCharge' => $this->input->post('foreignbankcharge'), 'OtherCharges' => $this->input->post('othercharges'), 'CandFCharges' => $this->input->post('candfcharges'), 'CustomDuty' => $this->input->post('customduty'), 'InsuranceAmount' => $this->input->post('insuranceamount'), 'PandTcharges' => $this->input->post('pandtcharges'), 'PaymentDate' => explode("/",$this->input->post('paymentdate'))[2].'-'.explode("/",$this->input->post('paymentdate'))[1].'-'.explode("/",$this->input->post('paymentdate'))[0], 'FCvalue' => $this->input->post('fcvalue'), 'ExRate' => $this->input->post('exrate'), 'INRValue' => $this->input->post('inrvalue'), 'TotalValue' => $this->input->post('totalvalue'), 'AverageRate' => $this->input->post('averagerate'), 'Remarks' => $this->input->post('remarks'), ); } else { $invoice_data=array( 'master_id' => $lastidInMasterImport->id+1, 'mi_id' => $this->input->post('importfileno'), 'InvoiceNo' => $this->input->post('invoicenor'), 'InvoiceDate' => explode("/",$this->input->post('invoicedate'))[2].'-'.explode("/",$this->input->post('invoicedate'))[1].'-'.explode("/",$this->input->post('invoicedate'))[0], 'DocAcceptDate' => explode("/",$this->input->post('docacceptdate'))[2].'-'.explode("/",$this->input->post('docacceptdate'))[1].'-'.explode("/",$this->input->post('docacceptdate'))[0], 'ReferenceNo' => $this->input->post('referencenor'), 'BankCharges' => $this->input->post('bankcharges'), 'ForeignBankCharge' => $this->input->post('foreignbankcharge'), 'OtherCharges' => $this->input->post('othercharges'), 'CandFCharges' => $this->input->post('candfcharges'), 'CustomDuty' => $this->input->post('customduty'), 'InsuranceAmount' => $this->input->post('insuranceamount'), 'PandTcharges' => $this->input->post('pandtcharges'), 'PaymentDate' => explode("/",$this->input->post('paymentdate'))[2].'-'.explode("/",$this->input->post('paymentdate'))[1].'-'.explode("/",$this->input->post('paymentdate'))[0], 'FCvalue' => $this->input->post('fcvalue'), 'ExRate' => $this->input->post('exrate'), 'INRValue' => $this->input->post('inrvalue'), 'TotalValue' => $this->input->post('totalvalue'), 'AverageRate' => $this->input->post('averagerate'), 'Remarks' => $this->input->post('remarks'), ); } //} else { $invoice_data=""; } if($this->input->post('paymenttype')=="LC") { $final_lc=$lc_data; } else { $final_lc=""; } if($this->input->post('editableid')) { $masterinsert=$this->yarn_model->masterimort_update($masters_data,$booking_data,$shipping_data,$cherw_shping,$invoice_data,$this->input->post('editableid')); } else { $masterinsert=$this->yarn_model->masterimort_insert1($masters_data,$booking_data,$final_lc,$shipping_data,$goodsdetails_data,$invoice_data); } if($masterinsert==1) { if($this->input->post('nextconsignment')) { $importfilenor=$this->input->post('importfileno'); //$consignmentnor=$this->input->post('consignmentno'); //$paymttype=$this->input->post('paymenttype'); //$check_lcdata_existed=$this->yarn_model->check_lcdata_exist($importfilenor); $this->session->set_flashdata('flash_message', $importfilenor); //$this->session->set_flashdata('consignmentflash', $consignmentnor); //$this->session->set_flashdata('paymenttypeprev', $paymttype); //$this->session->set_flashdata('lcexistedinformation', $check_lcdata_existed); redirect(base_url().'import/masters_import','refresh'); } else { redirect(base_url().'import/masters_import_details','refresh'); } } } } else { if($id!="") { $data['getEditData']=$this->yarn_model->getMiEditData($id); $data['getBookingNewEditData']=$this->yarn_model->getBDNewEditData($id); $data['getshippingNewEditData']=$this->yarn_model->getSDNewEditData($id); $data['getGDNewEditData']=$this->yarn_model->getGDNewEditData($id); $data['getGdRNewEditData']=@$this->yarn_model->getGDRNewEditData($this->yarn_model->getGDNewEditData($id)->id); //$data['getinvoiceNewEditData']=$this->yarn_model->getinvoiceNewEditData($id); $data['getinvoicedata']=$this->yarn_model->getinvoicedata($id); } $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('import_module/masters_import_dup',$data); $this->load->view('templates/footer_inside'); } } } public function edit_masters_import($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); $data['bookingtype']=$this->yarn_model->display_mastermodule_data(); $data['getquality']=$this->yarn_model->display_yarnQuality(); $data['yarndenier']=$this->yarn_model->display_yarndenier(); $data['getfileno']=$this->yarn_model->display_supplier_data(); $data['editdata']=$this->yarn_model->get_incentive_editdata($id); if($this->input->post('submitmi')) { $this->form_validation->set_rules('importfileno', 'Import File No', 'trim|required|xss_clean'); $this->form_validation->set_rules('consignmentno', 'Consignment No', 'trim|required|xss_clean'); $this->form_validation->set_rules('fileno', 'File No', 'trim|required|xss_clean'); $this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean'); $this->form_validation->set_rules('address', 'Address', 'trim|required|xss_clean'); $this->form_validation->set_rules('importtype', 'Import Type', 'trim|required|xss_clean'); $this->form_validation->set_rules('quality', 'Quality', 'trim|required|xss_clean'); $this->form_validation->set_rules('dinear', 'Dinear', 'trim|required|xss_clean'); $this->form_validation->set_rules('grade', 'Grade', 'trim|required|xss_clean'); $this->form_validation->set_rules('millno', 'Mill No', 'trim|required|xss_clean'); $this->form_validation->set_rules('bookingdate', 'Booking Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('bookingtype', 'Booking Type', 'trim|required|xss_clean'); $this->form_validation->set_rules('paymenttype', 'Payment Type', 'trim|required|xss_clean'); $this->form_validation->set_rules('salescontractno', 'Sales Contract No', 'trim|required|xss_clean'); $this->form_validation->set_rules('quantitybooked', 'Quantity Booked', 'trim|required|xss_clean'); $this->form_validation->set_rules('boxnoofbale', 'Box No Of Bale', 'trim|required|xss_clean'); $this->form_validation->set_rules('unitprice', 'Unit Price', 'trim|required|xss_clean'); $this->form_validation->set_rules('lcno', 'Lc No', 'trim|required|xss_clean'); $this->form_validation->set_rules('exchangerate', 'Exchange Rate', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('lcdate', 'Lc Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('lcvaluefcn', 'Lc Value Fcn', 'trim|required|xss_clean|numeric'); $this->form_validation->set_rules('lcbankaddress', 'Lc Bank Address', 'trim|required|xss_clean'); $this->form_validation->set_rules('lcexpirydate', 'Lc Expiry Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('lcamend', 'Lcamend', 'trim|required|xss_clean'); $this->form_validation->set_rules('recieveddate', 'Recieved Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('noofbalebox', 'No Of Bale Box', 'trim|required|xss_clean'); $this->form_validation->set_rules('recievedloation', 'recievedloation', 'trim|required|xss_clean'); $this->form_validation->set_rules('transportcharges', 'transportcharges', 'trim|required|xss_clean'); if($this->input->post('licensenor')) { $this->form_validation->set_rules('recievedquantity', 'Recieved Quantity', 'trim|required|xss_clean'); } $this->form_validation->set_rules('invoicenor', 'Invoice No', 'trim|required|xss_clean'); $this->form_validation->set_rules('invoicedate', 'Invoice Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('docacceptdate', 'Doc Accept Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('referencenor', 'Reference No', 'trim|required|xss_clean'); $this->form_validation->set_rules('bankcharges', 'Bank Charges', 'trim|required|xss_clean'); $this->form_validation->set_rules('foreignbankcharge', 'Foreign Bank Charge', 'trim|required|xss_clean'); $this->form_validation->set_rules('othercharges', 'Other Charges', 'trim|required|xss_clean'); $this->form_validation->set_rules('candfcharges', 'C and F Charges', 'trim|required|xss_clean'); $this->form_validation->set_rules('customduty', 'Custom Duty', 'trim|required|xss_clean'); $this->form_validation->set_rules('insuranceamount', 'Insurance Amount', 'trim|required|xss_clean'); $this->form_validation->set_rules('pandtcharges', 'P and T Charges', 'trim|required|xss_clean'); $this->form_validation->set_rules('paymentdate', 'Payment Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('fcvalue', 'FC Value', 'trim|required|xss_clean'); $this->form_validation->set_rules('exrate', 'Exrate', 'trim|required|xss_clean'); $this->form_validation->set_rules('inrvalue', 'INR value', 'trim|required|xss_clean'); $this->form_validation->set_rules('totalvalue', 'Total Value', 'trim|required|xss_clean'); $this->form_validation->set_rules('averagerate', 'Average Rate', 'trim|required|xss_clean'); $this->form_validation->set_rules('remarks', 'Remarks', 'trim|required|xss_clean'); $this->form_validation->set_rules('billentryno', 'Bill Entry Number', 'trim|required|xss_clean'); $this->form_validation->set_rules('billentrydate', 'Bill Entry Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('billloadingno', 'Bill Loading Number', 'trim|required|xss_clean'); $this->form_validation->set_rules('billloadingdate', 'Bill Loading Date', 'trim|required|xss_clean'); $this->form_validation->set_rules('port', 'Port', 'trim|required|xss_clean'); $this->form_validation->set_rules('eta', 'ETA', '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('import_module/edit_masters_import',$data); $this->load->view('templates/footer_inside'); } else { $masters_data = array( 'import_file_no'=> $this->input->post('importfileno'), 'consignment_no' => $this->input->post('consignmentno'), 'file_no' => $this->input->post('fileno'), 'name' => $this->input->post('name'), 'address' => $this->input->post('address'), 'import_type' => $this->input->post('importtype'), 'quality' => $this->input->post('quality'), 'dinear' => $this->input->post('dinear'), 'grade' => $this->input->post('grade'), 'mill_no' => $this->input->post('millno'), 'booking_date' => explode("/",$this->input->post('bookingdate'))[2].'-'.explode("/",$this->input->post('bookingdate'))[1].'-'.explode("/",$this->input->post('bookingdate'))[0], 'booking_type' => $this->input->post('bookingtype'), 'payment_type' => $this->input->post('paymenttype'), 'sales_contract_no' => $this->input->post('salescontractno'), 'quantity_booked' => $this->input->post('qbweights').' '.$this->input->post('quantitybooked'), 'box_no_of_bale' => $this->input->post('boxnoofbale'), 'unit_price' => $this->input->post('symbolcurrency').' '.$this->input->post('unitprice'), 'lc_no' => $this->input->post('lcno'), 'exchange_rate' => $this->input->post('exchangerate'), 'lc_date' => date('Y-m-d',strtotime($this->input->post('lcdate'))), 'lc_value_fcn' => $this->input->post('lcvaluefcn'), 'lc_bank_address' => $this->input->post('lcbankaddress'), 'lc_expiry_date' => date('Y-m-d',strtotime($this->input->post('lcexpirydate'))), 'lc_amend' => $this->input->post('lcamend'), 'RecievedDate' => date('Y-m-d',strtotime($this->input->post('recieveddate'))), 'NoofBaleBox' => $this->input->post('noofbalebox'), 'RecievedLocation' => $this->input->post('recievedloation'), 'TransportCharges' => $this->input->post('transportcharges'), 'InvoiceNo' => $this->input->post('invoicenor'), 'InvoiceDate' => date('Y-m-d',strtotime($this->input->post('invoicedate'))), 'DocAcceptDate' => date('Y-m-d',strtotime($this->input->post('docacceptdate'))), 'ReferenceNo' => $this->input->post('referencenor'), 'BankCharges' => $this->input->post('bankcharges'), 'ForeignBankCharge' => $this->input->post('foreignbankcharge'), 'OtherCharges' => $this->input->post('othercharges'), 'CandFCharges' => $this->input->post('candfcharges'), 'CustomDuty' => $this->input->post('customduty'), 'InsuranceAmount' => $this->input->post('insuranceamount'), 'PandTcharges' => $this->input->post('pandtcharges'), 'PaymentDate' => date('Y-m-d',strtotime($this->input->post('paymentdate'))), 'FCvalue' => $this->input->post('fcvalue'), 'ExRate' => $this->input->post('exrate'), 'INRValue' => $this->input->post('inrvalue'), 'TotalValue' => $this->input->post('totalvalue'), 'AverageRate' => $this->input->post('averagerate'), 'Remarks' => $this->input->post('remarks'), 'billEntryNo' => $this->input->post('billentryno'), 'billEntryDate' => explode("/",$this->input->post('billentrydate'))[2].'-'.explode("/",$this->input->post('billentrydate'))[1].'-'.explode("/",$this->input->post('billentrydate'))[0], 'billLoadingNo' => $this->input->post('billloadingno'), 'billLoadingDate' => explode("/",$this->input->post('billloadingdate'))[2].'-'.explode("/",$this->input->post('billloadingdate'))[1].'-'.explode("/",$this->input->post('billloadingdate'))[0], 'port' => $this->input->post('port'), 'eta' => date('Y-m-d',strtotime($this->input->post('eta'))) ); $masupdate=$this->yarn_model->master_import_update($masters_data,$id); if($incupdate==1) { redirect(base_url().'dashboard/masters_import_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('import_module/edit_masters_import',$data); $this->load->view('templates/footer_inside'); } } public function masters_name_address() { $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); $nameaddress=$this->yarn_model->get_name_address($_REQUEST['fileno']); foreach($nameaddress as $na_result) { echo $na_result->customer_name.'@@'.$na_result->address.'@@'.$na_result->purchase_type; } } public function import_consignment_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); $dispmulticonsign=$this->yarn_model->getmulti_consignments($_REQUEST['filenor']); echo json_encode($dispmulticonsign); } public function displayexistedQuantity() { $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); $licensenor=$_REQUEST['licensenor']; $selectcategory=$_REQUEST['selectcategory']; if($selectcategory=="advance_auth") { $dispqty=$this->yarn_model->getadvaceAuthdata($licensenor); } else if($selectcategory=="incentive_schemes") { $dispqty=$this->yarn_model->getincentiveschemedata($licensenor); } echo json_encode($dispqty); //echo $dispmulticonsign->balanceQuantity; } //display denier based on quality in import module public function displaydyndenier() { $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['yarnname']; $dispqty=$this->yarn_model->getdenierdata($yarnname); echo json_encode($dispqty); } public function getIMPfileDATA() { $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['impfilenor']=$impfileno=$_REQUEST['impfileno']; $data['dispDATA']=$this->yarn_model->getIMPfileDATA($impfileno); $this->load->view('import_module/importDetails',$data); } public function pdf_download($impfileno) { $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['impfilenor']=$impfileno; $dddd=$this->yarn_model->getIMPfileDATA($impfileno); $data['dispDATA']=$dddd; foreach($dddd as $rele) { $dddds=$this->db->query("SELECT * FROM mi_goods_license_recieved WHERE goods_details_id='".$rele->goodsdetid."'"); } $data['glrdata']=$dddds->result(); //$data['getalldata']=$this->yarn_model->getpdfdata($tablename); $this->load->helper('pdf_helper'); $this->load->view('pdf/pdfreport',$data); } }