private function savePart() { $form = 'frost.views.cms.part.text.TextAdd'; $part = Part::addMediaToPart($form,'Text'); // Add the 'preview' to the part $part = new Part(); $part->clauseSafe('part_id',Application::param('part_id')); $part->parse(); $part->save(); //Part::setParttagsAndSave($part,Application::param('current_tags')); Application::setParam('module_id',Application::param('module_id')); Application::redirect('ModuleDetail'); }
private function getTree() { if ($root = Part::model()->find('alias="carclub"')) { $tree = $this->convertMenuTree($root->getNestedTree()); } return $tree; }
public static function read_part($part) { // create temporary quote for one part $item = ['quote_id' => 0, 'quantity' => 1, 'override' => null]; $item += Part::read_part($part); $item['annual_fee'] = $item['price']; $quote = ['id' => 0, 'created' => null, 'key' => null, 'company' => null, 'address' => null, 'country' => null, 'billing_name' => null, 'billing_email' => null, 'billing_phone' => null, 'technical_name' => null, 'technical_email' => null, 'discount' => null, 'discount_desc' => null, 'first_fee' => $item['annual_fee'], 'annual_fee' => $item['annual_fee'], 'items' => [$item]]; return $quote; }
public function __construct($content = '', $filename = null, $contentType = 'application/octet-stream', $encoding = 'base64') { parent::__construct($content, $contentType, $encoding); $options = array(); if ($filename !== null) { $options['name'] = $filename; } $this->setContentType($contentType, $options); $this->setContentDisposition($filename); }
private function doParseBoundary($boundary) { $result = array(); $prefix = "--" . $boundary; $this->consumeRegexp("/\n*/"); $this->consumeTo($prefix); $this->consume($prefix); while ($this->expects("\n")) { $content = $this->consumeTo("\n" . $prefix); $part = new Part(); $part->loadSource($content); if ($part->isMultipart()) { $result += $part->getParts(); } else { $result[] = $part; } $this->consume("\n" . $prefix); } return $result; }
public function execute($smarty, $params, $session) { $smarty->assign('name', $session['screen_name']); $artists = Artist::findAll(); $smarty->assign('artists', $artists); $songs = Song::findAll(); $smarty->assign('songs', $songs); $parts = Part::findAll(); $smarty->assign('parts', $parts); $smarty->display('index.tpl'); }
public static function read_items($quote_id) { $items = QuoteItem::read(['*'], FALSE, ['quote_id = ?', $quote_id]); for ($i = 0; $i < count($items); ++$i) { $part = Part::read_part($items[$i]['part']); unset($part['id']); $items[$i] += $part; if (!is_null($items[$i]['override'])) { $items[$i]['price'] = $items[$i]['override']; } $items[$i]['annual_fee'] = $items[$i]['price'] * $items[$i]['quantity']; } return $items; }
public function draw() { $args = func_get_args(); $clone = clone $this; $clone->set('name', $this->getFormName()); $clone->set('id', $this->getId()); $clone->curry($args); try { Part::drawArray($clone->partPath, $clone->args); return true; } catch (MissingRequiredInputException $e) { throw new MissingRequiredDrawArgumentsException($e->getMessage(), 1); } }
public static function constructFromArray($props) { $name = $props['name']; $parts = array(); if (isset($props['parts'])) { foreach ($props['parts'] as $part) { if ($part instanceof Part) { $parts[] = $part; } else { $parts[] = Part::constructFromArray($part); } } } return new Score($name, $parts); }
/** * Construct the object * * @access public * @param array $parts * @param array $classes * @param string $key * @param integer $priority * * @throws \Zepi\Web\UserInterface\Exception Only Tab objects are allowd to add to a Tabs object. */ public function __construct($parts = array(), $classes = array(), $key = '', $priority = 10) { parent::__construct(array(), $classes, $key, $priority); if (is_array($parts)) { foreach ($parts as $part) { if ($part instanceof \Zepi\Web\UserInterface\Layout\Tab) { // Activate the first tab if (count($this->parts) === 0) { $part->setActive(true); } $this->addPart($part); } else { throw new Exception('Only Tab objects are allowed to add to a Tabs object.'); } } } }
public function order_custom($params = []) { $parts = Part::get_parts(); $order = Record::allow($params, array_keys($parts)); $key = Quote::get_unique_key([]); $model['`key`'] = $key; $fields = ['company', 'address', 'country', 'billing_name', 'billing_email', 'billing_phone', 'technical_name', 'technical_email', 'discount', 'discount_desc']; $model += Record::allow($params, $fields); $quote = Quote::create($model); $total = 0; foreach ($order as $name => $value) { if ($value) { $model = ['quote_id' => $quote['id'], 'part' => $name, 'override' => null, 'quantity' => $value]; QuoteItem::create($model); } } return Render::json(['key' => $key]); }
/** * Public constructor * * In addition to the parameters of Part::__construct() this constructor supports: * - file filename or file handle of a file with raw message content * - flags array with flags for message, keys are ignored, use constants defined in \Zend\Mail\Storage * * @param string $rawMessage full message with or without headers * @throws Exception */ public function __construct(array $params) { if (isset($params['file'])) { if (!is_resource($params['file'])) { $params['raw'] = @file_get_contents($params['file']); if ($params['raw'] === false) { throw new Exception\RuntimeException('could not open file'); } } else { $params['raw'] = stream_get_contents($params['file']); } } if (!empty($params['flags'])) { // set key and value to the same value for easy lookup $this->_flags = array_combine($params['flags'], $params['flags']); } parent::__construct($params); }
public static function add($userId, $artistName, $songName, $partName) { $pdo = new PDO('mysql:host=localhost; dbname=twitter_band', 'root', ''); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $artist = Artist::insertAndGet($pdo, $artistName); $song = Song::insertAndGet($pdo, $songName, $artist); $part = Part::insertAndGet($pdo, $partName); $st = $pdo->prepare(' select * from repertoire where user_id = ? and artist_id = ? and song_id = ? and part_id = ?'); $st->execute(array($userId, $artist->id, $song->id, $part->id)); if ($row = $st->fetch()) { return true; } else { $st = $pdo->prepare(' insert into repertoire(user_id, artist_id, song_id, part_id) values(?,?,?,?)'); $res = $st->execute(array($userId, $artist->id, $song->id, $part->id)); return true; } }
/** * Store a newly created resource in storage. * * @return Response */ public function store($story) { $input = $request->all(); $story_id = $story; $chapter = new chapter(); $part->story_id = $story_id; $part->title = $input['title']; $part->description = $input['description']; //place of part $position = 0; $current_position = Part::where('story_id', $story)->pluck('position'); if (empty($current_positioncount)) { $current_position = 0; } else { $current_position; } //current_position = 1 if ($position <= $current_position) { $position = $current_position + 1; //expect position to go to 2 } else { $position = $current_position; } $part->position = $position; //setting position 2 $part->save(); //image $destinatonPath = ''; $filename = ''; $file = Input::file('image'); $destinationPath = public_path() . '/images/parts'; $filename = $part->id . '_' . $file->getClientOriginalName(); $uploadSuccess = $file->move($destinationPath, $filename); $addimage = Part::find($part->id); $addimage->image = $filename; $addimage->save(); return redirect('story/' . $story . '/edit'); }
} ///end of selectlist class if (isset($_GET['type'])) { switch ($_GET['type']) { case 'customer': $cust = new Customer(); $cust->createCustomerList(); if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = 'Customer_ID'; } $sel = new selectlist($id, $cust->getCustomerList(), 'Select Customer', 'Customer_ID', 'Customer_Name_Short', 'class="required"', '', '1'); break; case 'drawing': $part = new Part(); $part->createPartList($_GET['cid']); if (isset($_GET['req'])) { $req = 'class=required'; } else { $req = ''; } if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = 'Drawing_ID'; } $sel = new selectlist($id, $part->getPartList(), 'Select Part No', 'Drawing_ID', 'name', $req, ''); break; case 'operator': $operator = new Operator();
private function getpart($type) { $items = Part::find(array("type=:type:", "bind" => array("type" => $type))); $parts = array(); foreach ($items as $index => $item) { $parts[$index] = $item; } return $parts; }
public function __construct($stream, $messageNumber, $partNumber = null, $structure = null) { parent::__construct($stream, $messageNumber, $partNumber, $structure); }
/** * @param \MailSo\Mime\Part $oIncPart * * @return \MailSo\Mime\Part */ private function createNewMessageMixedBody($oIncPart) { $oResultPart = null; $aAttachments = $this->oAttachmentCollection->UnlinkedAttachments(); if (0 < count($aAttachments)) { $oResultPart = Part::NewInstance(); $oResultPart->Headers->AddByName(\MailSo\Mime\Enumerations\Header::CONTENT_TYPE, \MailSo\Mime\Enumerations\MimeType::MULTIPART_MIXED . '; ' . ParameterCollection::NewInstance()->Add(Parameter::NewInstance(\MailSo\Mime\Enumerations\Parameter::BOUNDARY, $this->generateNewBoundary()))->ToString()); $oResultPart->SubParts->Add($oIncPart); foreach ($aAttachments as $oAttachment) { $oResultPart->SubParts->Add($this->createNewMessageAttachmentBody($oAttachment)); } } else { $oResultPart = $oIncPart; } return $oResultPart; }
/** * Adds a Part to the Page * * @access public * @param \Zepi\Web\UserInterface\Layout\Part $part */ public function addPart(Part $part) { $this->parts[] = $part; $part->setParent($this); }
function generateExcel($data = array()) { if (isset($data['did']) && $data['did'] != '') { $did = $data['did']; } if (isset($data['bid']) && $data['bid'] != '') { $bid = $data['bid']; } if (isset($data['jobno']) && $data['jobno'] != '') { $jobno = $data['jobno']; } if (isset($data['fairno']) && $data['fairno'] != '') { $fairno = $data['fairno']; } if (isset($data['inch']) && $data['inch'] != '') { $inch = $data['inch']; } if ($inch == 1) { $this->inch = 25.4; } $db = Database::getInstance(); $cxn = $db->getConnection(); $part = new Part(); $part->setValue('partid', $did); $part->setPartDetails(); $qz = "SELECT Mfg_Batch_NO FROM Batch_NO WHERE Batch_ID={$bid}"; if (!($rz = $cxn->query($qz))) { exit("error (generateExcel 0) {$qz} : {$cxn->error}"); } $rez = mysqli_fetch_assoc($rz); $mfgbatchno = $rez['Mfg_Batch_NO']; $objPHPExcel = new PHPExcel(); $objPHPExcel->getProperties()->setTitle("FAIR"); ///form 1 $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setTitle("Form 1"); $objPHPExcel->getActiveSheet()->mergeCells('A1:B1'); $objPHPExcel->getActiveSheet()->SetCellValue('A1', '1. Part Number'); $objPHPExcel->getActiveSheet()->mergeCells('A2:B2'); $objPHPExcel->getActiveSheet()->SetCellValue('A2', $part->getValue('partno')); $objPHPExcel->getActiveSheet()->mergeCells('C1:D1'); $objPHPExcel->getActiveSheet()->SetCellValue('C1', '2. Part Name'); $objPHPExcel->getActiveSheet()->mergeCells('C2:D2'); $objPHPExcel->getActiveSheet()->SetCellValue('C2', $part->getValue('partname')); $objPHPExcel->getActiveSheet()->mergeCells('E1:F1'); $objPHPExcel->getActiveSheet()->SetCellValue('E1', '3. Serial Number'); $objPHPExcel->getActiveSheet()->mergeCells('E2:F2'); $objPHPExcel->getActiveSheet()->mergeCells('G1:H1'); $objPHPExcel->getActiveSheet()->SetCellValue('G1', '4. FAIR Number'); $objPHPExcel->getActiveSheet()->mergeCells('G2:H2'); $objPHPExcel->getActiveSheet()->SetCellValue('G2', $fairno); $objPHPExcel->getActiveSheet()->mergeCells('A3:B3'); $objPHPExcel->getActiveSheet()->SetCellValue('A3', '5. Part Revision Level'); $objPHPExcel->getActiveSheet()->mergeCells('A4:B4'); $objPHPExcel->getActiveSheet()->SetCellValue('A4', $part->getValue('partrevision')); $objPHPExcel->getActiveSheet()->mergeCells('C3:D3'); $objPHPExcel->getActiveSheet()->SetCellValue('C3', '6. Drawing Number'); $objPHPExcel->getActiveSheet()->mergeCells('C4:D4'); $objPHPExcel->getActiveSheet()->SetCellValue('C4', $part->getValue('drawingno')); $objPHPExcel->getActiveSheet()->mergeCells('E3:F3'); $objPHPExcel->getActiveSheet()->SetCellValue('E3', '7. Drawing Revision Level'); $objPHPExcel->getActiveSheet()->mergeCells('E4:F4'); $objPHPExcel->getActiveSheet()->SetCellValue('E4', $part->getValue('drawingrevision')); $objPHPExcel->getActiveSheet()->mergeCells('G3:H3'); $objPHPExcel->getActiveSheet()->SetCellValue('G3', '8. Additional Changes'); $objPHPExcel->getActiveSheet()->mergeCells('G4:H4'); $objPHPExcel->getActiveSheet()->mergeCells('A5:B5'); $objPHPExcel->getActiveSheet()->SetCellValue('A5', '9. Manufactiring Process Reference'); $objPHPExcel->getActiveSheet()->mergeCells('A6:B6'); $objPHPExcel->getActiveSheet()->SetCellValue('A6', $mfgbatchno); $objPHPExcel->getActiveSheet()->mergeCells('C5:D5'); $objPHPExcel->getActiveSheet()->SetCellValue('C5', '10. Organization Name'); $objPHPExcel->getActiveSheet()->mergeCells('C5:D5'); $objPHPExcel->getActiveSheet()->SetCellValue('C5', 'Divya Engineering Works (P) Ltd'); $objPHPExcel->getActiveSheet()->mergeCells('E5:F5'); $objPHPExcel->getActiveSheet()->SetCellValue('E5', '11. Supplier Code'); $objPHPExcel->getActiveSheet()->mergeCells('E6:F6'); $objPHPExcel->getActiveSheet()->SetCellValue('E6', ''); $objPHPExcel->getActiveSheet()->mergeCells('G5:H5'); $objPHPExcel->getActiveSheet()->SetCellValue('G5', '12. P.O. Number'); $objPHPExcel->getActiveSheet()->mergeCells('G6:H6'); $objPHPExcel->getActiveSheet()->SetCellValue('G6', ''); $objPHPExcel->getActiveSheet()->mergeCells('A7:B7'); $objPHPExcel->getActiveSheet()->SetCellValue('A7', '13. Detail Part'); $objPHPExcel->getActiveSheet()->mergeCells('A8:B9'); $objPHPExcel->getActiveSheet()->SetCellValue('A8', 'Assembly FAI:'); $objPHPExcel->getActiveSheet()->mergeCells('C7:H7'); $objPHPExcel->getActiveSheet()->SetCellValue('C7', '14. Fill FAI: Partial FAI:'); $objPHPExcel->getActiveSheet()->mergeCells('C8:H8'); $objPHPExcel->getActiveSheet()->SetCellValue('C8', 'Baseline Part Number (including revision level):'); $objPHPExcel->getActiveSheet()->mergeCells('C9:H9'); $objPHPExcel->getActiveSheet()->SetCellValue('C9', 'Reason for Partial FAI:'); $objPHPExcel->getActiveSheet()->mergeCells('A10:H10'); $objPHPExcel->getActiveSheet()->SetCellValue('A10', 'a) If above part number is a detail part only, go to field 19.'); $objPHPExcel->getActiveSheet()->mergeCells('A11:H11'); $objPHPExcel->getActiveSheet()->SetCellValue('A11', 'b) If above part number is an assembly, go to the "INDEX" section below.'); $objPHPExcel->getActiveSheet()->mergeCells('A12:H12'); $objPHPExcel->getActiveSheet()->SetCellValue('A12', 'INDEX of part numbers or sub-assembly numbers required to make the assembly noted above.'); $objPHPExcel->getActiveSheet()->mergeCells('A13:B13'); $objPHPExcel->getActiveSheet()->SetCellValue('A13', '15. Part Number:'); $objPHPExcel->getActiveSheet()->mergeCells('C13:D13'); $objPHPExcel->getActiveSheet()->SetCellValue('C13', '16. Part Name:'); $objPHPExcel->getActiveSheet()->mergeCells('E13:F13'); $objPHPExcel->getActiveSheet()->SetCellValue('E13', '17. Part Serial Number:'); $objPHPExcel->getActiveSheet()->mergeCells('G13:H13'); $objPHPExcel->getActiveSheet()->SetCellValue('G13', '18. FAIR Number:'); $ir = 14; while ($ir < 31) { $objPHPExcel->getActiveSheet()->mergeCells('A' . $ir . ':B' . $ir); $objPHPExcel->getActiveSheet()->mergeCells('C' . $ir . ':D' . $ir); $objPHPExcel->getActiveSheet()->mergeCells('E' . $ir . ':F' . $ir); $objPHPExcel->getActiveSheet()->mergeCells('G' . $ir . ':H' . $ir); $ir++; } $objPHPExcel->getActiveSheet()->mergeCells('A31:B32'); $objPHPExcel->getActiveSheet()->SetCellValue('A31', '19. Signature'); $objPHPExcel->getActiveSheet()->mergeCells('C31:D32'); $objPHPExcel->getActiveSheet()->SetCellValue('C31', 'FAI Complete'); $objPHPExcel->getActiveSheet()->mergeCells('E31:F32'); $objPHPExcel->getActiveSheet()->SetCellValue('E31', 'FAI Not Complete'); $objPHPExcel->getActiveSheet()->mergeCells('G31:H32'); $objPHPExcel->getActiveSheet()->SetCellValue('G31', '20. Date:'); $objPHPExcel->getActiveSheet()->mergeCells('A33:F33'); $objPHPExcel->getActiveSheet()->SetCellValue('A33', '21. Reviewed By'); $objPHPExcel->getActiveSheet()->mergeCells('G33:H33'); $objPHPExcel->getActiveSheet()->SetCellValue('G33', '22. Date:'); $objPHPExcel->getActiveSheet()->mergeCells('A34:F34'); $objPHPExcel->getActiveSheet()->SetCellValue('A34', '23. Customer Approval'); $objPHPExcel->getActiveSheet()->mergeCells('G34:H34'); $objPHPExcel->getActiveSheet()->SetCellValue('G34', '24. Date:'); ///form 2 $objPHPExcel->createSheet(1); $objPHPExcel->setActiveSheetIndex(1); $objPHPExcel->getActiveSheet()->setTitle("Form 2"); $objPHPExcel->getActiveSheet()->mergeCells('A1:H2'); $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'FORM 2 - Product Accountability - Materials, Special Processes, and Functional Testing'); $objPHPExcel->getActiveSheet()->mergeCells('A2:B2'); $objPHPExcel->getActiveSheet()->SetCellValue('A2', '1. Part Number'); $objPHPExcel->getActiveSheet()->mergeCells('A3:B3'); $objPHPExcel->getActiveSheet()->SetCellValue('A3', ''); $objPHPExcel->getActiveSheet()->mergeCells('C2:D2'); $objPHPExcel->getActiveSheet()->SetCellValue('C2', '2. Part Name'); $objPHPExcel->getActiveSheet()->mergeCells('C3:D3'); $objPHPExcel->getActiveSheet()->SetCellValue('C3', ''); $objPHPExcel->getActiveSheet()->mergeCells('E2:F2'); $objPHPExcel->getActiveSheet()->SetCellValue('E2', '3. Serial Number'); $objPHPExcel->getActiveSheet()->mergeCells('E3:F3'); $objPHPExcel->getActiveSheet()->mergeCells('G2:H2'); $objPHPExcel->getActiveSheet()->SetCellValue('G2', '4. FAIR Number'); $objPHPExcel->getActiveSheet()->mergeCells('G3:H3'); $objPHPExcel->getActiveSheet()->SetCellValue('G3', ''); $objPHPExcel->getActiveSheet()->mergeCells('A4:B4'); $objPHPExcel->getActiveSheet()->SetCellValue('A4', '5. Material or Process Name:'); $objPHPExcel->getActiveSheet()->mergeCells('A5:B5'); $objPHPExcel->getActiveSheet()->SetCellValue('A5', ''); $objPHPExcel->getActiveSheet()->SetCellValue('C4', '6. Specification Number:'); $objPHPExcel->getActiveSheet()->SetCellValue('C5', ''); $objPHPExcel->getActiveSheet()->SetCellValue('D4', '7. Code:'); $objPHPExcel->getActiveSheet()->SetCellValue('D5', ''); $objPHPExcel->getActiveSheet()->SetCellValue('E4', '8. Supplier:'); $objPHPExcel->getActiveSheet()->SetCellValue('E5', ''); $objPHPExcel->getActiveSheet()->SetCellValue('G4', '9. Customer Approval Verification:'); $objPHPExcel->getActiveSheet()->SetCellValue('G5', ''); $objPHPExcel->getActiveSheet()->SetCellValue('H4', '10. Certificate of Conformance Number:'); $objPHPExcel->getActiveSheet()->SetCellValue('H5', ''); $ir = 6; while ($ir < 20) { $objPHPExcel->getActiveSheet()->mergeCells('A' . $ir . ':B' . $ir); $ir++; } $objPHPExcel->getActiveSheet()->mergeCells('A21:D21'); $objPHPExcel->getActiveSheet()->SetCellValue('A21', '11. Functional Test Procedure Number:'); $objPHPExcel->getActiveSheet()->mergeCells('E21:H21'); $objPHPExcel->getActiveSheet()->SetCellValue('E21', '12. Acceptance Report Number:'); $ir = 22; while ($ir < 29) { $objPHPExcel->getActiveSheet()->mergeCells('A' . $ir . ':D' . $ir); $objPHPExcel->getActiveSheet()->mergeCells('E' . $ir . ':H' . $ir); $ir++; } $objPHPExcel->getActiveSheet()->mergeCells('A29:H30'); $objPHPExcel->getActiveSheet()->SetCellValue('A29', '13. Comments:'); $objPHPExcel->getActiveSheet()->mergeCells('A31:F32'); $objPHPExcel->getActiveSheet()->SetCellValue('A31', '14. Signature:'); $objPHPExcel->getActiveSheet()->mergeCells('G31:H32'); $objPHPExcel->getActiveSheet()->SetCellValue('G31', '15. Date:'); //form 3 $objPHPExcel->createSheet(2); $objPHPExcel->setActiveSheetIndex(2); $objPHPExcel->getActiveSheet()->setTitle("Form 3"); $objPHPExcel->getActiveSheet()->mergeCells('A1:C3'); $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Divya Engineering Works (P) Ltd'); $objPHPExcel->getActiveSheet()->mergeCells('D1:F3'); $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'First Article Inspection Report'); $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Record Format Ref: DEW-QA-R-04'); $objPHPExcel->getActiveSheet()->SetCellValue('G2', 'Rev: Nil'); $objPHPExcel->getActiveSheet()->SetCellValue('G3', 'Issue Date: 01-12-2015'); $styleArray = array('font' => array('bold' => true, 'color' => array('rgb' => '000000'), 'size' => 12, 'name' => 'Verdana')); $objPHPExcel->getActiveSheet()->getStyle('A1:G3')->applyFromArray($styleArray); $objPHPExcel->getActiveSheet()->getStyle('A1:G3')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER); $objPHPExcel->getActiveSheet()->getStyle('A1:G3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $objPHPExcel->getActiveSheet()->mergeCells('A4:B4'); $objPHPExcel->getActiveSheet()->SetCellValue('A4', 'Part Name:' . $part->getValue('partname')); $objPHPExcel->getActiveSheet()->mergeCells('C4:D4'); $objPHPExcel->getActiveSheet()->SetCellValue('C4', 'Part No and Rev:' . $part->getValue('partno') . ' : ', $part->getValue('partrevision')); $styleArray = array('font' => array('bold' => true, 'color' => array('rgb' => '8470ff'), 'size' => 12, 'name' => 'Verdana')); $objPHPExcel->getActiveSheet()->getStyle('A4:D4')->applyFromArray($styleArray); $q1 = "SELECT DISTINCT(op.Operation_ID),Operation_Notation,Operation_Desc,Ope_Drawing_ID FROM Operation as op \n\tINNER JOIN Ope_Drawing as od on od.Link_ID=op.Operation_ID \n\tINNER JOIN Dimn_Observation as do on do.Ope_Rev_ID=od.Ope_Drawing_ID WHERE op.Drawing_ID={$did} AND do.Batch_ID={$bid} AND In_Tool_List=1"; if (!($r1 = $cxn->query($q1))) { exit("error (generateExcel) {$q1} : {$cxn->error}"); } $r = 5; while ($ro1 = mysqli_fetch_assoc($r1)) { $this->operationid = $ro1['Operation_ID']; $this->opedrawingid = $ro1['Ope_Drawing_ID']; $this->getDimensionsforOperation(); $objPHPExcel->getActiveSheet()->mergeCells('A' . $r . ':D' . $r); $objPHPExcel->getActiveSheet()->SetCellValue('A' . $r, 'Operation: ' . $ro1['Operation_Notation'] . ' ' . $ro1['Operation_Desc']); $cc = PHPExcel_Cell::stringFromColumnIndex(5 + count($jobno)); $objPHPExcel->getActiveSheet()->mergeCells('G' . $r . ':' . $cc . $r); $objPHPExcel->getActiveSheet()->SetCellValue('G' . $r, 'Observed Dimensions'); $r++; $hr = $r; //store row number to output headings $objPHPExcel->getActiveSheet()->SetCellValue('A' . $hr, 'Baloon No'); $objPHPExcel->getActiveSheet()->SetCellValue('B' . $hr, 'Zone'); $objPHPExcel->getActiveSheet()->SetCellValue('C' . $hr, 'Characteristic'); $objPHPExcel->getActiveSheet()->SetCellValue('D' . $hr, 'Description'); $objPHPExcel->getActiveSheet()->SetCellValue('E' . $hr, 'Basic Dimension'); $objPHPExcel->getActiveSheet()->SetCellValue('F' . $hr, 'Tolerance'); $objPHPExcel->getActiveSheet()->SetCellValue('G' . $hr, 'Instrument'); $styleArray = array('font' => array('bold' => true, 'color' => array('rgb' => '000080'), 'size' => 12, 'name' => 'Verdana')); $objPHPExcel->getActiveSheet()->getStyle('A' . $hr . ':G' . $hr)->applyFromArray($styleArray); $r++; $rm1 = $r; // var_dump($this->lrows); $z = 0; $y = 0; while ($y < count($this->lrows)) { $objPHPExcel->getActiveSheet()->SetCellValue('A' . $r, $this->lrows[$z][0]); $objPHPExcel->getActiveSheet()->SetCellValue('B' . $r, $this->lrows[$z][1]); $objPHPExcel->getActiveSheet()->SetCellValue('C' . $r, $this->lrows[$z][2]); $objPHPExcel->getActiveSheet()->SetCellValue('D' . $r, $this->lrows[$z][3]); $objPHPExcel->getActiveSheet()->SetCellValue('E' . $r, $this->lrows[$z][4]); $objPHPExcel->getActiveSheet()->SetCellValue('F' . $r, $this->lrows[$z][5]); $objPHPExcel->getActiveSheet()->SetCellValue('G' . $r, $this->lrows[$z][6]); $styleArray = array('font' => array('bold' => true, 'color' => array('rgb' => '696969'), 'size' => 11, 'name' => 'Verdana')); $objPHPExcel->getActiveSheet()->getStyle('A' . $r . ':G' . $r)->applyFromArray($styleArray); $r++; $y++; $z++; } $cn = 7; ///column H //var_dump($jobno); foreach ($jobno as $key => $value) { $q2 = "SELECT Dimn_Observation_ID FROM Dimn_Observation WHERE Batch_ID={$bid} AND Ope_Rev_ID={$this->opedrawingid} AND Job_NO={$value}"; if (!($r2 = $cxn->query($q2))) { exit("error (generateExcel) {$q2} : {$cxn->error}"); } $ro2 = mysqli_fetch_assoc($r2); $qry = "SELECT dimn.Dimension_ID, dimn.Operation_ID,DATE_FORMAT(Insp_Date,'%d/%m/%y') as sdt,Operator_Name,Instrument_SLNO,\n\t\t\tBasic_Dimn, ob.Dimn_Observation_ID, Batch_ID,Baloon_NO,ob.Remarks,\n\t\t\tJob_NO, Observed_Dimn,ob.Comment_ID,Comment FROM Observations as ob\n\t\t\tINNER JOIN Dimn_Observation as do ON do.Dimn_Observation_ID=ob.Dimn_Observation_ID\n\t\t\tLEFT OUTER JOIN Dimn_Comment AS dc ON dc.Comment_ID=ob.Comment_ID \n\t\t\tINNER JOIN Operator as ope ON ope.Operator_ID=do.Operator_ID \n\t\t\tINNER JOIN Instrument as ins ON ins.Instrument_ID=ob.Instrument_ID\n\t\t\tRIGHT OUTER JOIN Dimension as dimn ON dimn.Dimension_ID = ob.Dimension_ID \n\t\t\tAND do.Dimn_Observation_ID={$ro2['Dimn_Observation_ID']} AND do.Job_NO={$value}\n\t\t\tWHERE dimn.Ope_Drawing_ID = {$this->opedrawingid} ORDER BY Baloon_NO ASC"; // print("$qry<br>"); if (!($rest = $cxn->query($qry))) { exit("error (generateExcel 3) {$qry} : {$cxn->error}"); } $x = 0; $rm2 = $rm1; while ($row = mysqli_fetch_assoc($rest)) { $inst = ''; if (strpos($row['Observed_Dimn'], '|')) { $gonogo = explode('|', $row['Observed_Dimn']); $go = ', Go: ' . $gonogo[0] . ', No Go: ' . $gonogo[1]; } else { $go = ''; } if ($row['Comment'] == '') { $obt = explode('/', $row['Observed_Dimn']); $o = ''; $ii = 0; $jj = count($obt); while ($ii < $jj) { $o .= round($obt[$ii] / $this->inch, 4); if (isset($obt[$ii + 1])) { $o .= '/'; } $ii++; } if ($o == '0') { $o = ''; } if ($row['Instrument_SLNO'] != '') { $inst = ' Instrument: ' . $row['Instrument_SLNO']; } $ob = $o; } else { $ob = $row['Comment'] . $go; } $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($cn, $hr, 'Part No:' . $value); $styleArray = array('font' => array('bold' => true, 'color' => array('rgb' => '00bfff'), 'size' => 12, 'name' => 'Verdana')); $objPHPExcel->getActiveSheet()->getStyleByColumnAndRow($cn, $hr)->applyFromArray($styleArray); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($cn, $rm2, $ob . $inst . $row['Remarks']); $rm2++; $this->rrows[$z][$x] = $ob . $inst . $row['Remarks']; $this->name[$z] = $row['Operator_Name']; $x += 1; } $cn++; } $r++; } foreach (range('A', $cc) as $columnID) { $objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true); } $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); ob_end_clean(); $fair = $did . '-FAIR.xlsx'; header('Content-type: application/vnd.ms-excel'); header("Content-Disposition: attachment; filename={$fair}"); // Write file to the browser $objWriter->save('php://output'); }
<?php Part::input($action, 'string'); Part::input($display, 'string'); Part::input($selectedUrl, 'string'); if ($selectedUrl == $display) { $liClass = ' class="highlight"'; } else { $liClass = ''; } echo '<li' . $liClass . '>' . Html::anchor(Url::action($action), $display) . '</li>';
if ($pdf->getY() > $pdf->getPageHeight() - 75) { $pdf->rollbackTransaction(true); $pdf->AddPage(); $pdf->setY(56); $r = 1; } $pdf->SetFont('helvetica', '', 10); //body font if ($r) { $pdf->Cell(20, 8, $k, 0, 0, 'C'); ///print serial no } else { $pdf->Cell(20, 8, '', 0, 0, 'C'); //no serial no } $part = new Part(); $part->setPartID($dq_list[$j][0]); $part->setPartDetails(); $pdf->MultiCell(80, 8, $part->getPartName() . " " . $part->getDrawingNO() . ' Rev No: ' . $part->getPartRevision(), 0, 'L', 0, 0, '', '', true, 0, false, true, 8, 'M', true); //part name and drawing no $pdf->Cell(35, 8, $dq_list[$j][1], 0, 0, 'C'); //total quantity $pdf->Cell(50, 8, $dq_list[$j][2], 0, 1, 'L'); //remarks for each part ///print material receipt details if ($cqr_list[$j][0] != '') { $t = 0; while ($t < $dq_list[$j][1]) { $t += $cqr_list[$l][2]; $pdf->SetFont('helvetica', 'I', 8); //body font
<?php Part::input($items, 'array'); Part::input($even, 'Block'); Part::input($odd, 'Block'); $i = 0; foreach ($items as $item) { if ($i++ % 2 == 0) { $even->draw($item); } else { $odd->draw($item); } }
/** * Creates instances of segments * * @param string $rawValue The raw value of the segment * * @return \PitchBlade\Router\Path\Part The created segment */ public function build($rawValue) { $segment = new Part($rawValue); $segment->parse(); return $segment; }
$log = new Log($database); $current_user = new User($database, $current_user, $log, 1); // admin } catch (Exception $e) { $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); $fatal_error = true; } /******************************************************************************** * * Generate Table * *********************************************************************************/ if (!$fatal_error) { try { $parts = Part::get_noprice_parts($database, $current_user, $log); $table_loop = Part::build_template_table_array($parts, 'noprice_parts'); $html->set_loop('table', $table_loop); } catch (Exception $e) { $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); $fatal_error = true; } } /******************************************************************************** * * Set the rest of the HTML variables * *********************************************************************************/ $html->use_javascript(array('popup')); if (!$fatal_error) { // global stuff $html->set_variable('disable_footprints', $config['footprints']['disable'], 'boolean');
public function __construct($part_no) { parent::__construct($part_no, array('Component' => 'grp', 'Amperage' => 'amps', 'Busway Type' => 'frame_type')); $this->_details = $this->fetchDetails(); $this->setPricing($this->_details['display']); }
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); $fatal_error = true; } /******************************************************************************** * * Execute actions * *********************************************************************************/ if (!$fatal_error) { switch ($action) { case 'show_searched_parts': // show the search results for adding parts to this device try { // search parts by name and description $searched_parts = Part::search_parts($database, $current_user, $log, $new_part_name, '', true, true, false, false, false, false, false, false); $searched_parts_loop = Part::build_template_table_array($searched_parts, 'searched_device_parts'); $html->set_variable('searched_parts_rowcount', count($searched_parts), 'integer'); $html->set_variable('no_searched_parts_found', count($searched_parts) == 0, 'integer'); } catch (Exception $e) { $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); } break; case 'assign_by_selected': // add some parts (which were listed by part search) to this device for ($i = 0; $i < $searched_parts_rowcount; $i++) { $part_id = isset($_REQUEST['id_' . $i]) ? (int) $_REQUEST['id_' . $i] : 0; $quantity = isset($_REQUEST['quantity_' . $i]) ? abs((int) $_REQUEST['quantity_' . $i]) : 0; $mountname = isset($_REQUEST['mountnames_' . $i]) ? trim((string) $_REQUEST['mountnames_' . $i]) : ''; if ($quantity > 0) { try { // if there is already such Part in this Device, the quantity will be increased
<?php require_once 'autoload.php'; $_SESSION['LAST_ACTIVITY'] = time(); $part = new Part(); if (isset($_POST['drawingno'])) { //print_r($_POST); //var_dump($_FILES); if (isset($_POST['Drawing_ID'])) { $partid = $_POST['Drawing_ID']; } else { $partid = ''; } ///get part_id if we are editing an existing part. if (isset($_POST['pimg'])) { $pimg = $_POST['pimg']; } else { $pimg = ''; } ///ids for deleting preview images if (isset($_POST['drev'])) { $drev = $_POST['drev']; } else { $drev = ''; } ///drawing revision if (isset($_POST['prev'])) { $prev = $_POST['prev']; } else { $prev = ''; }
/** * @copydoc DBElement::check_values_validity() */ public static function check_values_validity(&$database, &$current_user, &$log, &$values, $is_new, &$element = NULL) { // first, we let all parent classes to check the values parent::check_values_validity($database, $current_user, $log, $values, $is_new, $element); // set the datetype of the boolean attributes settype($values['obsolete'], 'boolean'); // check "part_id" try { $part = new Part($database, $current_user, $log, $values['part_id']); $part->set_attributes(array()); // save part attributes to update its "last_modified" } catch (Exception $e) { debug('error', 'Ungültige "part_id": "' . $values['part_id'] . '"' . "\n\nUrsprüngliche Fehlermeldung: " . $e->getMessage(), __FILE__, __LINE__, __METHOD__); throw new Exception('Das gewählte Bauteil existiert nicht!'); } // check "id_supplier" try { if ($values['id_supplier'] < 1) { throw new Exception('id_supplier < 1'); } $supplier = new Supplier($database, $current_user, $log, $values['id_supplier']); } catch (Exception $e) { debug('error', 'Ungültige "id_supplier": "' . $values['id_supplier'] . '"' . "\n\nUrsprüngliche Fehlermeldung: " . $e->getMessage(), __FILE__, __LINE__, __METHOD__); throw new Exception('Der gewählte Lieferant existiert nicht!'); } }
public function getConnector() { $req = $this->config->getDomain() . "GetConnector"; if ($this->getVehicleID() != 0) { $req .= "?vehicleID=" . $this->getVehicleID(); } else { $req .= "?year=" . $this->year; $req .= "&make=" . urlencode($this->make); $req .= "&model=" . urlencode($this->model); $req .= "&style=" . urlencode($this->style); } $req .= "&dataType=" . $this->config->getDataType(); $resp = $this->helper->curlGet($req); $connector_arr = array(); foreach (json_decode($resp) as $obj) { $part = new Part(); $p = $part->castToPart($obj); array_push($connector_arr, $p); } return $connector_arr; }