public function index() { App::import('Model', 'QuoteManager.Quote'); $quoteModel = new Quote(); $quoteDataList = $quoteModel->find('all', array('fields' => array('quote_number', 'status'), 'conditions' => array('Quote.vid' => null, 'Quote.created_by' => $this->loginUser['id']))); App::import('Model', 'WorkOrderManager.WorkOrder'); $workOrderModel = new WorkOrder(); $workOrderDataList = $workOrderModel->find('all', array('fields' => array('work_order_number', 'status'), 'conditions' => array('WorkOrder.created_by' => $this->loginUser['id']))); App::import('Model', 'PurchaseOrderManager.PurchaseOrder'); $purchaseOrderModel = new PurchaseOrder(); $purchaseOrderDataList = $purchaseOrderModel->find('all', array('fields' => array('purchase_order_num', 'received'), 'conditions' => array('PurchaseOrder.created_by' => $this->loginUser['id']))); $this->set(compact('quoteDataList', 'workOrderDataList', 'purchaseOrderDataList')); }
public function getWOSkid($skid_no = null) { $this->autoRender = false; App::import('Model', 'WorkOrderManager.WorkOrder'); $WorkOrder_Model = new WorkOrder(); $WorkOrder_data = $WorkOrder_Model->find('first', array('conditions' => array('WorkOrder.skid_number' => $skid_no))); if (!empty($WorkOrder_data)) { $WO_datas = $WorkOrder_Model->find('all', array('conditions' => array('WorkOrder.skid_number' => $skid_no), "recursive" => -1)); $wo_number = ""; $wo_id = ""; $cnt = count($WO_datas); foreach ($WO_datas as $WO_data) { $wo_number .= $WO_data['WorkOrder']['work_order_number']; $wo_id .= $WO_data['WorkOrder']['id']; if ($cnt > 1) { $wo_number .= ","; $wo_id .= ","; } $cnt--; } $data['skid_number'] = $WorkOrder_data['WorkOrder']['skid_number']; $data['skid_weight'] = $WorkOrder_data['WorkOrder']['skid_weight']; $data['wo_number'] = $wo_number; $data['wo_id'] = $wo_id; echo json_encode($data); } else { App::import('Model', 'ContainerManager.SkidInventory'); $SkidInventory_Model = new SkidInventory(); $SkidInventory_data = $SkidInventory_Model->find('first', array('conditions' => array('SkidInventory.skid_no' => $skid_no))); if (!empty($SkidInventory_data)) { $data['skid_number'] = $SkidInventory_data['SkidInventory']['skid_no']; $data['skid_weight'] = $SkidInventory_data['SkidInventory']['weight']; $data['wo_number'] = null; $data['wo_id'] = null; } else { $data['skid_number'] = ''; $data['skid_weight'] = "0.00"; $data['wo_number'] = null; $data['wo_id'] = null; } echo json_encode($data); } exit; }
<?php require_once 'app_code/config.inc.php'; require_once 'class/class.contacts.php'; require_once 'class/class.project.php'; require_once 'class/class.note.php'; require_once 'class/class.tasks.php'; require_once 'class/class.GlobalTask.php'; require_once 'class/class.WorkOrder.php'; require_once 'app_code/class.Event_Contacts.php'; require_once 'app_code/zipcode.class.php'; $page = new basic_page(); $page->auth->Checklogin(); $workorder = new WorkOrder(); $order_id = $_REQUEST["order_id"]; $label = $workorder->get_shipping_label($order_id); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>View/Print Label</TITLE> <META content="text/html; charset=utf-8" http-equiv=Content-Type> <STYLE>.small_text { FONT-SIZE: 80%}.large_text { FONT-SIZE: 115%}</STYLE> <META name=GENERATOR content="MSHTML 8.00.7600.16588"> </HEAD> <BODY bgColor=#ffffff> <TABLE border=0 cellSpacing=0 cellPadding=0 width=600></TABLE> <TBODY> <TR> <TD height=410 vAlign=top align=left><B class=large_text>View/Print Label</B> <BR> <BR> <OL class=small_text> <LI><B>Print the label:</B> Select Print from the File menu in this browser window to print the label below.<BR><BR> <LI><B>Fold the printed label at the dotted line.</B> Place the label in a UPS Shipping Pouch. If you do not have a pouch, affix the folded label using clear plastic shipping tape over the entire label.<BR><BR> <LI><B>GETTING YOUR SHIPMENT TO UPS<BR>Customers without a Daily Pickup</B> <UL> <LI>Take this package to any location of The UPS Store®, UPS Drop Box, UPS Customer Center, UPS Alliances (Office Depot® or Staples®) or Authorized Shipping Outlet near you or visit <A href="http://www.ups.com/content/us/en/index.jsx">www.ups.com/content/us/en/index.jsx</A> and select Drop Off. <LI>Air shipments (including Worldwide Express and Expedited) can be picked up or dropped off. To schedule a pickup, or to find a drop-off location, select the Pickup or Drop-off icon from the UPS tool bar. </LI></UL><BR><B>Customers with a Daily Pickup</B> <UL> <LI>Your driver will pickup your shipment(s) as usual. </LI></UL></LI></OL></TD></TR></TBODY></TABLE><TABLE border=0 cellSpacing=0 cellPadding=0 width=600> <TBODY> <TR> <TD class=small_text vAlign=top align=left> <A name=foldHere>FOLD HERE</A></TD></TR> <TR> <TD vAlign=top align=left> <HR> </TD></TR></TBODY></TABLE><TABLE> <TBODY> <TR> <TD height=10> </TD></TR></TBODY></TABLE><TABLE border=0 cellSpacing=0 cellPadding=0 width=650> <TBODY> <TR> <TD vAlign=top align=left> <img src="data:image/gif;base64,<?php echo $label;
function getWOInfo($id = null) { App::import('Model', 'WorkOrderManager.WorkOrder'); $WorkOrder = new WorkOrder(); $WorkOrder_data = $WorkOrder->find("first", array("conditions" => array('WorkOrder.id' => $id))); return $WorkOrder_data; }
public function corn_job() { $this->layoutOpt['layout'] = 'report'; App::import('Model', 'WorkOrderManager.WorkOrder'); $WorkOrder_Model = new WorkOrder(); $work_order = $WorkOrder_Model->find("all", array("conditions" => array("WorkOrder.is_print" => 0), "recursive" => -1)); $user_id = $this->loginUser['id']; $this->set(compact('work_order', 'user_id')); }
public function getWorkOrder($id = null, $customer_id) { App::import("Model", "WorkOrderManager.WorkOrder"); $WorkOrder_model = new WorkOrder(); $work_order = $WorkOrder_model->find("first", array("conditions" => array("WorkOrder.id" => $id))); $this->set(compact('id', 'work_order', "customer_id")); $this->render('Elements/PartialData/getWorkOrder'); }
require_once 'class/class.note.php'; require_once 'class/class.tasks.php'; require_once 'class/class.GlobalTask.php'; require_once 'class/class.WorkOrder.php'; require_once 'app_code/class.Event_Contacts.php'; require_once 'app_code/zipcode.class.php'; require_once 'class/class.CalcDate.php'; $fileserver = new fileserver(); //echo "FILESERVER_PRE"; $fileserver->check_fileUpload(); //echo "FILESERVER_POST"; $page = new basic_page(); $page->auth->Checklogin(); $notify = new Notification(); $ajax = new PHPLiveX(); $workorder = new WorkOrder(); $project = new Project(); $note = new Note(); $user = new User(); $task = new Tasks(); $global_task = new GlobalTask(); $em = new Event_Contacts(); $task->SetUserObject($user); $task->SetUserID($page->auth->Get_user_id()); $ajax->AjaxifyObjects(array("fileserver", "global_task", "project", "task", "global_task", "workorder", "em", "note")); $em->SetUserID($page->auth->Get_user_id()); $em->SetContactID($_SESSION['contact_id']); $em->SetUserName($page->auth->Get_user_name()); $page->setPageKeywords(''); $page->setPageDescription(''); $page->setPageTitle("WORK ORDER");
function auto_generate_number($type) { $value = ""; if ($type == "Quote") { App::uses('Quote', 'QuoteManager.Model'); $quoteModel = new Quote(); $quotes = $quoteModel->find('all', array('fields' => array('Quote.id,Quote.quote_number'))); if ($quotes) { $quote_number = (int) $quotes[count($quotes) - 1]['Quote']['quote_number']; $quote_number = explode("-", $quote_number); $length = strlen($quote_number[0] + 1) == strlen($quote_number[0]) ? strlen($quote_number[0]) : strlen($quote_number[0] + 1); for ($i = $length; $i < 6; $i++) { $value .= '0'; } $value .= $quote_number[0] + 1; } else { $value = "000001"; } } elseif ($type == "Work Order") { App::uses('WorkOrder', 'WorkOrderManager.Model'); $woModel = new WorkOrder(); $wos = $woModel->find('all', array('fields' => array('WorkOrder.id,work_order_number'))); if ($wos) { $wo_number = (int) $wos[count($wos) - 1]['WorkOrder']['work_order_number']; $length = strlen($wo_number + 1) == strlen($wo_number) ? strlen($wo_number) : strlen($wo_number + 1); for ($i = $length; $i < 6; $i++) { $value .= '0'; } $value .= $wo_number + 1; } else { $value = "000001"; } } elseif ($type == "Purchase Order") { App::uses('PurchaseOrder', 'PurchaseOrderManager.Model'); $poModel = new PurchaseOrder(); $pos = $poModel->find('all', array('fields' => array('PurchaseOrder.id,purchase_order_num'))); if ($pos) { $po_number = (int) $pos[count($pos) - 1]['PurchaseOrder']['purchase_order_num']; $length = strlen($po_number + 1) == strlen($po_number) ? strlen($po_number) : strlen($po_number + 1); for ($i = $length; $i < 6; $i++) { $value .= '0'; } $value .= $po_number + 1; } else { $value = "000001"; } } elseif ($type == "Invoice") { App::uses('Invoice', 'Invoice.Model'); $invoiceModel = new Invoice(); $invoice = $invoiceModel->find('all', array('fields' => array('Invoice.id,invoice_no'))); if ($invoice) { $invoice_number = (int) $invoice[count($invoice) - 1]['Invoice']['invoice_no']; $length = strlen($invoice_number + 1) == strlen($invoice_number) ? strlen($invoice_number) : strlen($invoice_number + 1); for ($i = $length; $i < 6; $i++) { $value .= '0'; } $value .= $invoice_number + 1; } else { $value = "000001"; } } return $value; }
} } else { $return .= "<div style='width: 100%;background: green;' >No Down Payment Needed</div>\n <script>global_task.submit_flowchartTask('{$value}' , '{$chart_assign_id}' ,'order', '{$module_id}', '{$target}' , '', '{$module_id}' , { target: '{$target}'});\$('#payment_parrent_div').remove();</script>"; } } else { $return .= "<div style='width: 100%;background: red;' >" . $card["error"] . "</div>"; } } else { $tmp1 = $this->db->fetch_assoc($this->db->query("SELECT shipping_charges , grant_total , state_tax , county_tax , stadium_tax , total_tax FROM erp_order WHERE order_id = {$module_id}")); $full = $tmp1["grant_total"]; $bill_amount = $full; $total_arr = $this->db->fetch_assoc($this->db->query("SELECT SUM( amount ) total FROM `payments` WHERE for_module_name = 'order' AND for_module_id = '{$module_id}' AND refund='no'")); $already_payed = $total_arr["total"]; if (round($bill_amount, 2) > round($already_payed, 2)) { $bill_amount = round(round($bill_amount, 2) - round($already_payed, 2), 2); $workorder = new WorkOrder(); $tax = $workorder->calculate_tax($module_id, '0'); $pa = array(); $pa["payee_module_name"] = "contacts"; $pa["payee_module_id"] = $args["contact_id"]; $pa["for_module_name"] = "order"; $pa["for_module_id"] = $module_id; $pa["chart_assign_id"] = $args["chart_assign_id"]; $pa["amount"] = $bill_amount; $pa["curency"] = "USD"; $pa["payment_module"] = $payment_type; $pa["payment_module_id"] = $args["ccid"]; $pa["payment_type"] = "final"; $pa["state_tax"] = $tmp1["state_tax"]; $pa["county_tax"] = $tmp1["county_tax"]; $pa["stadium_tax"] = $tmp1["stadium_tax"];
public function getQuote($id = null) { $this->autoRender = false; App::import('Model', 'WorkOrderManager.WorkOrder'); $workOrderModel = new WorkOrder(); $workOrder = $workOrderModel->find("first", array("conditions" => array("WorkOrder.id" => $id))); $all_items = $this->QuoteItem->ListQuoteItems($workOrder['Quote']['id']); $all_items = $this->QuoteItem->AdjustPOItem($all_items); //pr($all_items);exit; // debug($all_items); // $main_item_list = $all_items['quantity_list']; // $price_list = $all_items['price_list']; // $title_list = $all_items['title_list']; // $name_list = $all_items['name_list']; // $restrictedSupplier = $this->QuoteItemComponent->RestrictedSupplierOfPO($work_id); // $supplier_list = $this->QuoteItem->SupplierAndItemInfo(); App::import('Model', 'QuoteManager.Quote'); $quote = new Quote(); //$quote->recursive = 3; $quote_info = $quote->find("first", array("conditions" => array("Quote.id" => $workOrder['Quote']['id']))); $add_formate = $this->QuoteItem->address_format($quote_info['Quote']['address'], $quote_info['Quote']['city'], $quote_info['Quote']['province'], $quote_info['Quote']['country'], $quote_info['Quote']['postal_code']); if (!empty($quote_info['Quote']['est_shipping'])) { $quote_info['Quote']['est_shipping'] = $this->dateFormatPo($quote_info['Quote']['est_shipping']); } else { if ($quote_info['Quote']['delivery'] == '4 - 8 Weeks Delivery') { $add_days = 56; $today = $quote_info['Quote']['quote_created_date']; $esd_date = date('d/m/Y', strtotime($today) + 24 * 3600 * $add_days); } if ($quote_info['Quote']['delivery'] == '5 - 10 Weeks Delivery') { $add_days = 70; $today = $quote_info['Quote']['quote_created_date']; $esd_date = date('d/m/Y', strtotime($today) + 24 * 3600 * $add_days); } $quote_info['Quote']['est_shipping'] = $esd_date; } $quote_info['Quote']['sales_person'] = unserialize($quote_info['Quote']['sales_person']); $quote_info['Quote']['address_formate'] = $add_formate; $quote_info['all_item'] = $all_items; echo json_encode($quote_info); }
/** * Get WorkOrder models from soap payload * @return Array of WorkOrder models */ private function get_work_order_models() { require_once OFSC_ROOT . 'xtree.php'; require_once OFSC_ROOT . 'workorder.php'; $workOrders = array(); $payload = $this->get_http_post_data(); $payload = htmlspecialchars_decode($payload); $payloadTree = new xtree(array('xmlRaw' => $payload, 'stripNamespaces' => true)); $messages = $payloadTree->xtree->Envelope->Body->send_message->messages->message; if (count($messages) == 1) { $workOrder = new WorkOrder(); $workOrder->setMsgId($messages->message_id->_['value']); $workOrder->setUsername($messages->body->username->_['value']); $workOrder->setPassword($messages->body->password->_['value']); $workOrder->setWorkOrderId($messages->body->appt_number->_['value']); $workOrder->setContact($messages->body->customer_number->_['value']); $workOrder->setContactPhone($messages->body->cphone->_['value']); $workOrder->setContactEmail($messages->body->cemail->_['value']); $workOrder->setContactMobilePhone($messages->body->ccell->_['value']); $workOrder->setWorkOrderTimeSlot($messages->body->time_slot->_['value']); $workOrder->setWorkOrderDate($messages->body->date->_['value']); $workOrder->setWorkOrderStatus($messages->body->astatus->_['value']); $workOrder->setEndTime($messages->body->end_time->_['value']); $workOrder->setStartEndTime($messages->body->eta_end_time->_['value']); $workOrder->setEta($messages->body->ETA->_['value']); $workOrder->setExternalId($messages->body->aid->_['value']); $workOrder->setDeliveryWindowStart($messages->body->delivery_window_start->_['value']); $workOrder->setDeliveryWindowEnd($messages->body->delivery_window_end->_['value']); $workOrder->setResource($messages->body->pname->_['value']); $workOrder->setTravelTime($messages->body->travel->_['value']); $workOrder->setFieldServiceNote($messages->body->XA_ACTIVITY_NOTES->_['value']); $workOrder->setDuration($messages->body->duration->_['value']); array_push($workOrders, $workOrder); } else { foreach ($messages as $val) { $workOrder = new WorkOrder(); $workOrder->setUsername($val->body->username->_['value']); $workOrder->setPassword($val->body->password->_['value']); $workOrder->setMsgId($val->message_id->_['value']); $workOrder->setWorkOrderId($val->body->appt_number->_['value']); $workOrder->setContact($val->body->customer_number->_['value']); $workOrder->setContactPhone($val->body->cphone->_['value']); $workOrder->setContactEmail($val->body->cemail->_['value']); $workOrder->setContactMobilePhone($val->body->ccell->_['value']); $workOrder->setWorkOrderTimeSlot($val->body->time_slot->_['value']); $workOrder->setWorkOrderDate($val->body->date->_['value']); $workOrder->setWorkOrderStatus($val->body->astatus->_['value']); $workOrder->setEndTime($val->body->end_time->_['value']); $workOrder->setStartEndTime($val->body->eta_end_time->_['value']); $workOrder->setEta($val->body->ETA->_['value']); $workOrder->setExternalId($val->body->aid->_['value']); $workOrder->setDeliveryWindowStart($val->body->delivery_window_start->_['value']); $workOrder->setDeliveryWindowEnd($val->body->delivery_window_end->_['value']); $workOrder->setResource($val->body->pname->_['value']); $workOrder->setTravelTime($val->body->travel->_['value']); $workOrder->setFieldServiceNote($val->body->XA_ACTIVITY_NOTES->_['value']); $workOrder->setDuration($val->body->duration->_['value']); array_push($workOrders, $workOrder); } } return $workOrders; }
if (empty($res) || count($res) == 0) { echo "Skip: Unknown Sender: {$from_mail}\n"; continue; } if (count($res) != 1) { echo "Skip: Multiple Matches: {$from_mail}\n"; continue; } $c = $res[0]; echo "From Contact: {$c['email']}\n"; continue; // Examine Mail Parts // $part_list = mail_part_list($stat); // print_r($part_list); // continue; $wo = new WorkOrder(null); $wo['auth_user_id'] = 1; $wo['contact_id'] = $c['id']; $wo['requester'] = trim($from->personal); $wo['note'] = $stat['subject'] . "\n"; $part_list = mail_part_list($stat); if ($part_list) { foreach ($part_list as $mime_id => $part) { echo "Mime Part: {$mime_id}\n"; switch ($part['mime-type']) { case 'text/html': // @todo Attach to WO? echo "Unhandled HTML Part\n"; break; case 'text/plain': switch ($part['mime-encoding']) {
/** @todo Should be Part of WorkOrder Class */ function wo2iv($id) { $wo = new WorkOrder($id); try { $iv = $wo->toInvoice(); } catch (Exception $e) { echo "EE " . $e . "\n"; return false; } echo "WO #{$wo->id} => IV #{$iv->id} for {${$iv->bill_amount}}\n"; // Post to their Account $C = new Contact($iv->contact_id); // Generate a Transaction to Post to This Clients Account Receivable $aje = new AccountJournalEntry(); $aje->date = $iv->date; $aje->note = 'Charge for Invoice #' . $iv->id; $aje->save(); // Debit Accounts Receivable for this Client $ale = new AccountLedgerEntry(); $ale->account_id = $_ENV['account']['receive_account_id']; $ale->account_journal_id = $aje->id; $ale->amount = abs($iv->bill_amount) * -1; $ale->link_to = ImperiumBase::getObjectType('contact'); $ale->link_id = $iv->contact_id; $ale->save(); // Credit Customer Account - or Revenue for Instant Revenue? // Old Query, Why from account by contact? $ale = new AccountLedgerEntry(); if ($C->account_id) { $ale->account_id = $C->account_id; } else { $ale->account_id = $_ENV['account']['revenue_account_id']; } $ale->account_journal_id = $aje->id; $ale->amount = abs($iv->bill_amount); $ale->link_to = ImperiumBase::getObjectType($iv); $ale->link_id = $iv->id; $ale->save(); echo "IV Posted {$aje->note} " . number_format($ale->amount, 2) . "\n"; // Send The Invoice via Email return $iv; }
/** * edit method * * @param string $id * @return void */ public function edit($id = null, $section = null) { $this->InstallerSchedule->id = $id; if (!$this->InstallerSchedule->exists()) { throw new NotFoundException(__('Invalid Installer')); } if ($this->request->is('post') || $this->request->is('put')) { if ($this->InstallerSchedule->save($this->request->data)) { $this->Session->setFlash(__('The Installer has been saved')); $this->redirect(array('action' => 'detail_section', $this->InstallerSchedule->id, $section)); } else { $this->Session->setFlash(__('The Installer could not be saved. Please, try again.')); } } else { $this->request->data = $this->InstallerSchedule->read(null, $id); } $user_id = $this->loginUser['id']; App::uses('Installer', 'ScheduleManager.Model'); $installerModel = new Installer(); $installers = $installerModel->find('list', array('fields' => array('id', 'name_lookup_id'))); App::uses('WorkOrder', 'WorkOrderManager.Model'); $workOrderModel = new WorkOrder(); $workOrders = $workOrderModel->find('list', array('fields' => array('id', 'work_order_number'), 'conditions' => array('status' => 'Approve'))); $this->set(compact('user_id', 'workOrders', 'installers', 'id', 'section')); }
/** * edit method * * @param string $id * @return void */ public function edit($id = null, $section = null) { $this->ServiceEntry->id = $id; if (!$this->ServiceEntry->exists()) { throw new NotFoundException(__('Invalid ServiceEntry')); } if ($this->request->is('post') || $this->request->is('put')) { // $s_date = date("Y-m-d H:i:s", strtotime($this->formatDate($this->request->data['ServiceEntry']['created']))); // $add_e_date = strtotime($this->formatDate($this->request->data['ServiceEntry']['booked_for'])) + ( 60 * 60 ); // $e_date = date("Y-m-d H:i:s", $add_e_date); // $schedule['Appointment']['work_order_id'] = $this->request->data['ServiceEntry']['work_order_id']; // $schedule['Appointment']['created_by'] = $this->request->data['ServiceEntry']['created_by']; // $schedule['Appointment']['type'] = $this->request->data['ServiceEntry']['type']; // $schedule['Appointment']['start_date'] = $s_date; // $schedule['Appointment']['end_date'] = $e_date; // App::import('Model', 'ScheduleManager.Appointment'); // $Appointment_Model = new Appointment(); // $app_data = $Appointment_Model->find("first", array("conditions" => array("Appointment.service_entry_id" => $id))); // $schedule['Appointment']['id'] = $app_data['Appointment']['id']; if ($this->ServiceEntry->save($this->request->data)) { // $Appointment_Model->save($schedule); $this->Session->setFlash(__('The Service Entry has been saved')); if ($section != 'basic') { $this->redirect(array('action' => 'detail_section', $this->ServiceEntry->id, $section)); } else { $this->redirect(array('action' => 'detail_section', $this->ServiceEntry->id, $section)); } } else { $this->Session->setFlash(__('The Service Entry could not be saved. Please, try again.')); } } else { $this->request->data = $this->ServiceEntry->read(null, $id); } App::uses('WorkOrder', 'WorkOrderManager.Model'); $workOrderModel = new WorkOrder(); $workOrders = $workOrderModel->find('list', array('fields' => array('id', 'work_order_number'), 'conditions' => array('status' => 'Approve'))); $user_id = $this->loginUser['id']; $this->set(compact('workOrders', 'purchaseOrders', 'user_id', 'id', 'section')); }
function getWOAddress($id = null) { $this->autoRender = false; App::import('Model', 'WorkOrderManager.WorkOrder'); $workOrderModel = new WorkOrder(); $workOrder = $workOrderModel->find("first", array("conditions" => array("WorkOrder.id" => $id))); echo json_encode($workOrder); }