Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function progressdone($type) {
- if(isset($_POST["comment"])) {
- $draft = "";
- $emails = array(); $report_to = array();
- foreach($this->M_user->getLists() as $k => $r) {
- $emails[$r->emp_id] = $r->email;
- $user_name[$r->emp_id] = $r->emp_name;
- $report_to[$r->emp_id] = $r->report_to;
- }
- $status_order = array("" => "");
- foreach($this->M_param->getStatusOrder() as $k => $r) $status_order[$r->STATUS_ORDER_ID] = $r->STATUS_ORDER_NAME;
- $cust = array(""=>"");
- foreach($this->M_param->getCustomer() as $k => $r) $cust[$r->cust_id] = $r->cust_name." [ ".$r->cust_code." ]";
- $bu = array(""=>"");
- foreach($this->M_param->getBUList() as $k => $r) $bu[$r->BU_ID] = $r->BU_NAME;
- $vendor = array(""=>"");
- foreach($this->M_param->getVendor() as $k => $r) $vendor[$r->vendor_id] = $r->vendor_name;
- // Upload Process
- $this->load->library('upload');
- $config['upload_path'] = './application/third_party/upload/draft/';
- $config['allowed_types'] = '*';
- $config['max_size'] = '10000000'; // 10 MB
- $config['overwrite'] = TRUE;
- /*
- for($i=0; $i<=2; $i++){
- if($_FILES["draft_file"]["name"]!="") {
- $file_id = md5($_POST["order_id"].date("YmdHis"));
- $config['file_name'] = "draft_".$type."_".$file_id;
- $this->upload->initialize($config);
- if ( ! $this->upload->do_upload("draft_file")) {
- $error = $this->upload->display_errors();
- echo "<script>";
- echo "alert('Error: ".$error."');";
- echo "document.location.href='".site_url("/lo/progress/".$type."/".$_POST["order_id"])."';";
- echo "</script>";
- } else {
- $data = $this->upload->data();
- $draft = $data["file_name"];
- }
- }
- }*/
- if (isset($_POST['coba'])){
- $coba=$_POST['coba'];
- $file = '';
- for ($i = 0; $i < count($coba); $i++) {
- $file = $coba[$i] .'|'. $file;
- }
- }
- else{
- $file='';
- }
- $this->M_contract->insertHistAppr($_POST["order_id"],
- $this->session->userdata("d_user_id"), $_POST["rev_reason"], $file, $_POST["status"]);
- // Insert file for hit onthefly
- $bitfile ="";
- /*$bitfile = date("His");
- $myfile = fopen("hit/".$bitfile.".php", "a+") or die("Unable to open file!");
- $txt = "<?php\n".
- "header(\"location:http://lcm.telkomsigma.co.id/index.php/lo/progress/".$type."/".$_POST["order_id"]."\");\n".
- "?>\n";
- fwrite($myfile, $txt);
- fclose($myfile);*/
- switch($type) {
- case "sales":
- $this->M_lo->setLOSalesStatus($_POST["order_id"], $_POST["status"]);
- $lo = $this->M_lo->getLOSales("order_id='".$_POST["order_id"]."'");
- break;
- case "purc":
- $this->M_lo->setLOVendorStatus($_POST["order_id"], $_POST["status"]);
- $lo = $this->M_lo->getLOVendor("order_id='".$_POST["order_id"]."'");
- break;
- case "part":
- $this->M_lo->setLOPartnerStatus($_POST["order_id"], $_POST["status"]);
- $lo = $this->M_lo->getLOPartner("order_id='".$_POST["order_id"]."'");
- break;
- case "mou":
- $this->M_lo->setLOMouStatus($_POST["order_id"], $_POST["status"]);
- $lo = $this->M_lo->getLOMou("order_id='".$_POST["order_id"]."'");
- break;
- case "nda":
- $this->M_lo->setLONdaStatus($_POST["order_id"], $_POST["status"]);
- $lo = $this->M_lo->getLONda("order_id='".$_POST["order_id"]."'");
- break;
- }
- switch($type) {
- case "sales":
- $this->M_profiling->writelog("LO:Sales:Progress", "Updated:".$_POST["order_id"].":".substr(trim($_POST["rev_reason"]),0,10),
- $this->session->userdata("d_user_id"));
- break;
- case "purc":
- $this->M_profiling->writelog("LO:Purchasing:Progress", "Updated:".$_POST["order_id"].":".substr(trim($_POST["rev_reason"]),0,10),
- $this->session->userdata("d_user_id"));
- break;
- case "part":
- $this->M_profiling->writelog("LO:Partnership:Progress", "Updated:".$_POST["order_id"].":".substr(trim($_POST["rev_reason"]),0,10),
- $this->session->userdata("d_user_id"));
- break;
- case "mou":
- $this->M_profiling->writelog("LO:MoU:Progress", "Updated:".$_POST["order_id"].":".substr(trim($_POST["rev_reason"]),0,10),
- $this->session->userdata("d_user_id"));
- break;
- case "nda":
- $this->M_profiling->writelog("LO:NDA:Progress", "Updated:".$_POST["order_id"].":".substr(trim($_POST["rev_reason"]),0,10),
- $this->session->userdata("d_user_id"));
- break;
- }
- // Email notifikasi
- //$to = $emails[$_POST["requester"]].(($_POST["legal_officer"]!="")?",".$emails[$_POST["legal_officer"]]:"");
- //$cc = $emails[ $report_to[$_POST["requester"]] ].",cicilia.putri@sigma.co.id";
- $cc = "fiki.robby@sigma.co.id";
- $message = "";
- switch($type) {
- case "sales":
- $to = $emails[$_POST["requester"]].(($_POST["legal_officer"]!="")?",".$emails[$_POST["legal_officer"]]:"");
- $subject = "[Legal] Progress Status Legal Order Sales ".$_POST["order_id"];
- $message = "Dear Legal Officer and Account Manager, <br><br>".
- "For Legal Order Sales LO number <b>".$_POST["order_id"]."</b> there is a progress that needs to be followed up as follows: <br>".
- "<table>".
- "<tr><td style='background:#DADADA; width:150px'>No. LO </td><td style='width:650px'><b><a href='lcm.telin.sg/legal/hit/".$bitfile.".php'>".$_POST["order_id"]."</a></b></td></tr>".
- "<tr><td style='background:#DADADA'>No. IWO/Opportunity</td><td><b>".$lo[0]->iwo_no."</b></td></tr>".
- "<tr><td style='background:#DADADA'>Project Name</td><td>".$lo[0]->project_name."</td></tr>".
- "<tr><td style='background:#DADADA'>Customer </td><td>".$cust[$lo[0]->cust_id]."</td></tr>".
- "<tr><td style='background:#DADADA'>Last Response</td><td>".$_POST["rev_reason"]."<br><span style='font-size:10px;font-family:Arial'>by: ".$user_name[ $this->session->userdata("d_user_id") ]."</span></td></tr>".
- "<tr><td style='background:#DADADA'>Status</td><td>".$status_order[$_POST["status"]]."</td></tr>".
- "</table><br>".
- "Please login <a href='lcm.telin.sg/legal'>Legal Compliance Management</a> for more information.".
- "<br><br>Thank you.";
- // =====================================================================================================
- // $message = "";
- // =====================================================================================================
- break;
- case "purc":
- $to = $emails[$_POST["requester"]].(($_POST["legal_officer"]!="")?",".$emails[$_POST["legal_officer"]]:"");
- $subject = "[Legal] Progress Status Legal Order Purchasing ".$_POST["order_id"];
- $message = "Dear. Requester and Legal Officer, <br><br>".
- "For Legal Order Sales LO number <b>".$_POST["order_id"]."</b> there is a progress that needs to be followed up as follows: <br>".
- "<table>".
- "<tr><td style='background:#DADADA; width:150px'>No. LO </td><td style='width:650px'><b><a href='lcm.telin.sg/legal/hit/".$bitfile.".php'>".$_POST["order_id"]."</a></b></td></tr>".
- "<tr><td style='background:#DADADA'>No. PO </td><td><b>".$lo[0]->po_no."</b></td></tr>".
- "<tr><td style='background:#DADADA'>Project Name</td><td>".$lo[0]->project_name."</td></tr>".
- "<tr><td style='background:#DADADA'>Mitra </td><td>".$vendor[$lo[0]->vendor_id]."</td></tr>".
- "<tr><td style='background:#DADADA'>Last Response</td><td>".$_POST["rev_reason"]."<br><span style='font-size:10px;font-family:Arial'>by: ".$user_name[ $this->session->userdata("d_user_id") ]."</span></td></tr>".
- "<tr><td style='background:#DADADA'>Status</td><td>".$status_order[$_POST["status"]]."</td></tr>".
- "</table><br>".
- "Silahkan login ke <a href='lcm.telin.sg/legal'>Legal Compliance Management</a> For more information.".
- "<br><br>Thank you.";
- break;
- case "part":
- $to = $emails[$_POST["requester"]].(($_POST["legal_officer"]!="")?",".$emails[$_POST["legal_officer"]]:"");
- $subject = "[Legal] Progress Status Legal Order Partnership ".$_POST["order_id"];
- $message = "Dear. Requester and Legal Officer, <br><br>".
- "For Legal Order Sales LO number <b>".$_POST["order_id"]."</b> there is a progress that needs to be followed up as follows: <br>".
- "<table>".
- "<tr><td style='background:#DADADA; width:150px'>No. LO </td><td style='width:650px'><b><a href='lcm.telin.sg/legal/hit/".$bitfile.".php'>".$_POST["order_id"]."</a></b></td></tr>".
- "<tr><td style='background:#DADADA'>Project Name</td><td>".$lo[0]->project_name."</td></tr>".
- "<tr><td style='background:#DADADA'>Last Response</td><td>".$_POST["rev_reason"]."<br><span style='font-size:10px;font-family:Arial'>by: ".$user_name[ $this->session->userdata("d_user_id") ]."</span></td></tr>".
- "<tr><td style='background:#DADADA'>Status</td><td>".$status_order[$_POST["status"]]."</td></tr>".
- "</table><br>".
- "Please login <a href='lcm.telin.sg/legal'>Legal Compliance Management</a> for more information.".
- "<br><br>Thank you.";
- break;
- case "mou":
- $to = $emails[$_POST["requester"]].(($_POST["legal_officer"]!="")?",".$emails[$_POST["legal_officer"]]:"");
- $subject = "[Legal] Progress Status Legal Order Mou ".$_POST["order_id"];
- $message = "Dear. Requester and Legal Officer, <br><br>".
- "For Legal Order Sales LO number <b>".$_POST["order_id"]."</b> there is a progress that needs to be followed up as follows: <br>".
- "<table>".
- "<tr><td style='background:#DADADA; width:150px'>No. LO </td><td style='width:650px'><b><a href='lcm.telin.sg/legal/hit/".$bitfile.".php'>".$_POST["order_id"]."</a></b></td></tr>".
- "<tr><td style='background:#DADADA'>Project Name</td><td>".$lo[0]->project_name."</td></tr>".
- "<tr><td style='background:#DADADA'>Last Response</td><td>".$_POST["rev_reason"]."<br><span style='font-size:10px;font-family:Arial'>by: ".$user_name[ $this->session->userdata("d_user_id") ]."</span></td></tr>".
- "<tr><td style='background:#DADADA'>Status</td><td>".$status_order[$_POST["status"]]."</td></tr>".
- "</table><br>".
- "Please login <a href='lcm.telin.sg/legal'>Legal Compliance Management</a> for more information.".
- "<br><br>Thank you.";
- break;
- case "nda":
- $to = $emails[$_POST["requester"]].(($_POST["legal_officer"]!="")?",".$emails[$_POST["legal_officer"]]:"");
- $subject = "[Legal] Progress Status Legal Order NDA ".$_POST["order_id"];
- $message = "Dear. Requester and Legal Officer, <br><br>".
- "For Legal Order Sales LO number <b>".$_POST["order_id"]."</b> there is a progress that needs to be followed up as follows: <br>".
- "<table>".
- "<tr><td style='background:#DADADA; width:150px'>No. LO </td><td style='width:650px'><b><a href='lcm.telin.sg/legal/hit/".$bitfile.".php'>".$_POST["order_id"]."</a></b></td></tr>".
- "<tr><td style='background:#DADADA'>No. IWO/Opportunity</td><td><b>".$lo[0]->iwo_no."</b></td></tr>".
- "<tr><td style='background:#DADADA'>Project Name</td><td>".$lo[0]->project_name."</td></tr>".
- "<tr><td style='background:#DADADA'>Customer </td><td>".$cust[$lo[0]->cust_name]."</td></tr>".
- "<tr><td style='background:#DADADA'>Last Response</td><td>".$_POST["rev_reason"]."<br><span style='font-size:10px;font-family:Arial'>by: ".$user_name[ $this->session->userdata("d_user_id") ]."</span></td></tr>".
- "<tr><td style='background:#DADADA'>Status</td><td>".$status_order[$_POST["status"]]."</td></tr>".
- "</table><br>".
- "Please login <a href='lcm.telin.sg/legal'>Legal Compliance Management</a> for more information.".
- "<br><br>Thank you.";
- break;
- }
- if ($_POST['status']==6) {
- $config = array(
- 'smtp_crypto' => 'tls',
- 'protocol' => 'smtp',
- 'smtp_host' => 'smtp.office365.com',
- 'smtp_port' => '587',
- 'smtp_user' => 'lcm@telin.sg',
- 'smtp_pass' => 'PvM1cUHXN$',
- 'mailtype' => 'html',
- 'charset' => 'utf-8'
- );
- $this->email->initialize($config);
- $this->email->set_mailtype("html");
- $this->email->set_newline("\r\n");
- $this->email->to('cicilia308@gmail.com');
- $this->email->from('lcm@telin.sg','Telin LCM');
- $this->email->subject('Registration LCM Apps');
- $this->email->message($message);
- if (!$this->email->send()){
- echo $this->email->print_debugger();
- // redirect("/pr/user");
- }else{
- echo $this->email->print_debugger();
- }
- } else{
- }
- $this->M_param->sendEmail($to, $cc, $subject, $message);
- }
- //progressdone
- $cond = "UPPER(order_id) LIKE '%".strtoupper($_POST["order_id"])."%'";
- $this->viewLegalOrder($type,$cond);
- //$this->$type($cond);
- //redirect ($this->viewLegalOrder($type,$cond));
- //redirect("/lo/sales/".$type."/".$cond);
- // redirect("/lo/progress/".$type."/".$_POST["order_id"]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement