public function exportExcel() { $objPHPExcel = new PHPExcel(); $row = 1; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, Prado::localize('JobID')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $row, Prado::localize('Date Stringing')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $row, Prado::localize('Customer')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $row, Prado::localize('Racquet')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $row, Prado::localize('SerialRacquet')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $row, Prado::localize('Stringer')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $row, Prado::localize('StringingMachine')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $row, Prado::localize('StringMains')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $row, Prado::localize('Tension')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $row, Prado::localize('Prestretch')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $row, Prado::localize('StringCross')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(11, $row, Prado::localize('Tension')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(12, $row, Prado::localize('Prestretch')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(13, $row, Prado::localize('StringingType')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(14, $row, Prado::localize('DynamicTension')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(15, $row, Prado::localize('Stencyl')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(16, $row, Prado::localize('GrommetsGuard')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(17, $row, Prado::localize('Grips')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(18, $row, Prado::localize('Overgrips')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(19, $row, Prado::localize('TotalPrice')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(20, $row, Prado::localize('NoteStringing')); $objPHPExcel->getActiveSheet()->getStyle('A1:Z1')->getFont()->setBold(true); $this->CreateArrayJobsCustomer($this->FilterCollection_brand->getNoFieldCondition(), $this->FilterCollection_model->getNoFieldCondition(), $this->FilterCollection_serial->getNoFieldCondition()); $row = $row + 2; for ($j = 0; $j < count($this->DataJobsCustomer); $j++) { $job = $this->DataJobsCustomer[$j]; $stringJob = $this->formatJob($job->id); $racquetCustomer = TblRacquetsUser::finder()->findBy_id($job->tbl_racquets_user_id); $customer = TblUsers::finder()->findBy_id($racquetCustomer->tbl_users_id); $racquetModel = TblRacquets::finder()->findBy_id($racquetCustomer->tbl_racquets_id); $brandRacquet = TblBrands::finder()->findBy_id($racquetModel->tbl_brands_id); $stringingMachine = TblStringingMachines::finder()->findBy_id($job->tbl_stringing_machines_id); $brandStringingMachine = TblBrands::finder()->findBy_id($stringingMachine->tbl_brands_id); $mainString = TblStrings::finder()->findBy_id($job->tbl_strings_id_main); $brandMainString = TblBrands::finder()->findBy_id($mainString->tbl_brands_id); $gaugeMainString = TblGauges::finder()->findBy_id($mainString->tbl_gauges_id); //$row->gauge_desc = $gauge->usa . " (" . $gauge->diameter.")"; $crossString = TblStrings::finder()->findBy_id($job->tbl_strings_id_cross); $brandCrossString = TblBrands::finder()->findBy_id($crossString->tbl_brands_id); $gaugeCrossString = TblGauges::finder()->findBy_id($crossString->tbl_gauges_id); $stringingJobType = TblStringingJobType::finder()->findBy_id($job->tbl_stringing_type_id); $stencyl = Prado::localize('No'); if ($job->stencyl == 1) { $stencyl = Prado::localize('Yes'); } $grommet = Prado::localize('No'); if ($job->grommets_guard == 1) { $grommet = Prado::localize('Yes'); } $gripString = Prado::localize('No'); if ($job->tbl_grip_id != 0) { $grip = TblGrips::finder()->findBy_id($job->tbl_grip_id); $brand = TblBrands::finder()->findBy_id($grip->tbl_brands_id); $gripString = $brand->description . " " . $grip->model; } $overgripString = Prado::localize('No'); if ($job->tbl_overgrip_id != null) { $overgrip = TblOvergrips::finder()->findBy_id($job->tbl_overgrip_id->id); $brand = TblBrands::finder()->findBy_id($overgrip->tbl_brands_id); $overgripString = $brand->description . " " . $overgrip->model; } $y = substr($job->date_stringing, 0, 4); $m = substr($job->date_stringing, 5, 2); $d = substr($job->date_stringing, 8, 2); $dateString = $d . "-" . $m . "-" . $y; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, $stringJob); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $row, $dateString); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $row, $customer->name . ' ' . $customer->surname); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $row, $brandRacquet->description . ' ' . $racquetModel->model); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $row, $racquetCustomer->serial); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $row, $this->User->UserDB->name . ' ' . $this->User->UserDB->surname); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $row, $brandStringingMachine->description . ' ' . $stringingMachine->model); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $row, $brandMainString->description . ' ' . $mainString->model); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $row, $job->weight_main . ' ' . $this->User->UserDB->weight_unit->description); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $row, $job->prestretch_main . ' %'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $row, $brandCrossString->description . ' ' . $crossString->model); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(11, $row, $job->wieght_cross . ' ' . $this->User->UserDB->weight_unit->description); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(12, $row, $job->prestretch_cross . ' %'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(13, $row, $stringingJobType->description); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(14, $row, $job->dynamic_tension); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(15, $row, $stencyl); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(16, $row, $grommet); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(17, $row, $gripString); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(18, $row, $overgripString); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(19, $row, $job->total_price); //$objPHPExcel->getActiveSheet()->getStyle('D'.$row)->getNumberFormat()->setFormatCode('0.00'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(20, $row, $job->note); $row++; } $objPHPExcel->getActiveSheet()->setTitle(Prado::localize('CLAIM_CHECK')); $objPHPExcel->setActiveSheetIndex(0); header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="export.xls"'); header('Cache-Control: max-age=0'); header('Cache-Control: max-age=1'); header('Expires: Mon, 26 Jul 2030 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: cache, must-revalidate'); header('Pragma: public'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); }
function makeHtmlJob($job) { //.''. '..' $stringJob = $this->formatJob($job->id); $racquetCustomer = TblRacquetsUser::finder()->findBy_id($job->tbl_racquets_user_id); $customer = TblUsers::finder()->findBy_id($racquetCustomer->tbl_users_id); $racquetModel = TblRacquets::finder()->findBy_id($racquetCustomer->tbl_racquets_id); $brandRacquet = TblBrands::finder()->findBy_id($racquetModel->tbl_brands_id); $stringingMachine = TblStringingMachines::finder()->findBy_id($job->tbl_stringing_machines_id); $brandStringingMachine = TblBrands::finder()->findBy_id($stringingMachine->tbl_brands_id); $mainString = TblStrings::finder()->findBy_id($job->tbl_strings_id_main); $brandMainString = TblBrands::finder()->findBy_id($mainString->tbl_brands_id); $gaugeMainString = TblGauges::finder()->findBy_id($mainString->tbl_gauges_id); //$row->gauge_desc = $gauge->usa . " (" . $gauge->diameter.")"; $crossString = TblStrings::finder()->findBy_id($job->tbl_strings_id_cross); $brandCrossString = TblBrands::finder()->findBy_id($crossString->tbl_brands_id); $gaugeCrossString = TblGauges::finder()->findBy_id($crossString->tbl_gauges_id); $stringingJobType = TblStringingJobType::finder()->findBy_id($job->tbl_stringing_type_id); $stencyl = Prado::localize('No'); if ($job->stencyl == 1) { $stencyl = Prado::localize('Yes'); } $grommet = Prado::localize('No'); if ($job->grommets_guard == 1) { $grommet = Prado::localize('Yes'); } $gripString = Prado::localize('No'); if ($job->tbl_grip_id != 0) { $grip = TblGrips::finder()->findBy_id($job->tbl_grip_id); $brand = TblBrands::finder()->findBy_id($grip->tbl_brands_id); $gripString = $brand->description . " " . $grip->model; } $overgripString = Prado::localize('No'); if ($job->tbl_overgrip_id != 0) { $overgrip = TblOvergrips::finder()->findBy_id($job->tbl_overgrip_id); $brand = TblBrands::finder()->findBy_id($overgrip->tbl_brands_id); $overgripString = $brand->description . " " . $overgrip->model; } $y = substr($job->date_stringing, 0, 4); $m = substr($job->date_stringing, 5, 2); $d = substr($job->date_stringing, 8, 2); $dateString = $d . "-" . $m . "-" . $y; $htmlMain = '<table border="1" cellpadding="2"> <tr> <td colspan="4" ><span style="font-weight:bold">' . Prado::localize('StringMains') . '</span> </td> </tr> <tr> <td colspan="4" align="center">' . $brandMainString->description . ' ' . $mainString->model . ' ' . $gaugeMainString->usa . ' (' . $gaugeMainString->diameter . ') </td> </tr> <tr> <td >' . Prado::localize('Tension') . ' </td> <td >' . $job->weight_main . ' ' . $this->User->UserDB->weight_unit->description . ' </td> <td >' . Prado::localize('Prestretch') . ' </td> <td >' . $job->prestretch_main . ' % </td> </tr> </table>'; $htmlCross = '<table border="1" cellpadding="2"> <tr> <td colspan="4" ><span style="font-weight:bold">' . Prado::localize('StringCross') . '</span> </td> </tr> <tr> <td colspan="4" align="center">' . $brandCrossString->description . ' ' . $crossString->model . ' ' . $gaugeCrossString->usa . ' (' . $gaugeCrossString->diameter . ') </td> </tr> <tr> <td >' . Prado::localize('Tension') . ' </td> <td >' . $job->wieght_cross . ' ' . $this->User->UserDB->weight_unit->description . ' </td> <td >' . Prado::localize('Prestretch') . ' </td> <td >' . $job->prestretch_cross . ' % </td> </tr> </table>'; $html = '<table border="1" cellpadding="4"> <tr> <td>' . Prado::localize('JobID') . ' </td> <td >' . $stringJob . ' </td> <td>' . Prado::localize('Date Stringing') . ' </td> <td >' . $dateString . ' </td> </tr> <tr> <td>' . Prado::localize('Customer') . ' </td> <td colspan="3">' . $customer->name . ' ' . $customer->surname . ' </td> </tr> <tr> <td>' . Prado::localize('Racquet') . ' </td> <td colspan="3">' . $brandRacquet->description . ' ' . $racquetModel->model . ' </td> </tr> <tr> <td>' . Prado::localize('SerialRacquet') . ' </td> <td colspan="3">' . $racquetCustomer->serial . ' </td> </tr> <tr> <td>' . Prado::localize('Stringer') . ' </td> <td colspan="3">' . $this->User->UserDB->name . ' ' . $this->User->UserDB->surname . ' </td> </tr> <tr> <td>' . Prado::localize('StringingMachine') . ' </td> <td colspan="3">' . $brandStringingMachine->description . ' ' . $stringingMachine->model . ' </td> </tr> <tr> <td colspan="4">' . $htmlMain . ' </td> </tr> <tr> <td colspan="4">' . $htmlCross . ' </td> </tr> <tr> <td width="25%">' . Prado::localize('StringingType') . ' </td> <td width="25%">' . $stringingJobType->description . ' </td> <td width="25%">' . Prado::localize('DynamicTension') . ' </td> <td width="25%">' . $job->dynamic_tension . ' </td> </tr> <tr> <td>' . Prado::localize('Stencyl') . ' </td> <td>' . $stencyl . ' </td> <td>' . Prado::localize('GrommetsGuard') . ' </td> <td>' . $grommet . ' </td> </tr> <tr > <td width="15%">' . Prado::localize('Grips') . ' </td> <td width="35%">' . $gripString . ' </td> <td width="15%">' . Prado::localize('Overgrips') . ' </td> <td width="35%">' . $overgripString . ' </td> </tr> <tr> <td width="20%">' . Prado::localize('TotalPrice') . ' </td> <td width="80%">' . $job->total_price . ' </td> </tr> <tr> <td width="20%">' . Prado::localize('NoteStringing') . ' </td> <td width="80%">' . $job->note . ' </td> </tr> </table>'; return $html; }
public function createEditZone($job, $clone) { $this->editable->Visible = true; if ($clone) { $this->DATA_JOB_TITLE->Text = Prado::localize('DataNewJob'); $this->DateStringing->setTimeStamp(strtotime("now")); } else { $this->DATA_JOB_TITLE->Text = Prado::localize('EditNewJob') . " " . $this->formatJob($job->id); $this->DateStringing->setTimeStamp(strtotime($job->date_stringing)); } $this->EDIT_RACQUET->Visible = true; //Clienti $arrayClienti = array(); $sqlmap = $this->Application->Modules['sqlmap']->Database; $sqlmap->Active = true; $sql = "SELECT distinct tbl_users.id, tbl_users.name, tbl_users.surname FROM tbl_users\r\n\t\t\tINNER JOIN rel_stringer_customer ON rel_stringer_customer.id_customer = tbl_users.id\r\n\t\t\tINNER JOIN tbl_racquets_user ON tbl_racquets_user.tbl_users_id = tbl_users.id\r\n\t\t\twhere rel_stringer_customer.id_stringer = " . $this->User->UserDB->id . " \r\n\t\t\torder by tbl_users.name desc, tbl_users.surname desc"; $command = $sqlmap->createCommand($sql); $testArray = $command->query()->readAll(); foreach ($testArray as $row) { $arrayClienti[$row["id"]] = $row["name"] . " " . $row["surname"]; } $this->DDLCustomers->DataSource = $arrayClienti; $this->DDLCustomers->dataBind(); $this->DDLCustomers->SelectedValue = $this->customer->id; $this->DDLCustomers->Enabled = false; //racchette clienti $this->ChangeCustomersRacquets($this->customer->id); $this->DDLCustomerRacquets->SelectedValue = $job->tbl_racquets_user_id; $this->DDLCustomerRacquets->Enabled = false; $racquetUser = TblRacquetsUser::finder()->findBy_id($job->tbl_racquets_user_id); $racquet = TblRacquets::finder()->findBy_id($racquetUser->tbl_racquets_id); $brandRacquet = TblBrands::finder()->findBy_id($racquet->tbl_brands_id); $criteria = new TActiveRecordCriteria(); $criteria->OrdersBy['model'] = 'asc'; $striningMachineArray = array(); $striningMachine = TblStringingMachines::finder()->findAll($criteria); foreach ($striningMachine as $row) { $brand = TblBrands::finder()->findBy_id($row->tbl_brands_id); $row->brand_name = $brand->description; $striningMachineArray[$row->id] = $row->brand_name . " " . $row->model; } $this->DDLStriningMachine->DataSource = $striningMachineArray; $this->DDLStriningMachine->dataBind(); $this->DDLStriningMachine->SelectedValue = $job->tbl_stringing_machines_id; $i = 0; $brand_name = array(); $model = array(); $stringArray = array(); $string = TblStrings::finder()->findAll(); foreach ($string as $row) { $brand = TblBrands::finder()->findBy_id($row->tbl_brands_id); $row->brand_name = $brand->description; $brand_name[$i] = $row->brand_name; $model[$i] = $row->model; $i++; $gauge = TblGauges::finder()->findBy_id($row->tbl_gauges_id); $row->gauge_desc = $gauge->usa . " (" . $gauge->diameter . ")"; $stringArray[$row->id] = $row->brand_name . " " . $row->model . " " . $row->gauge_desc; } asort($stringArray); $stringArray = array(); $sql = "SELECT tbl_strings.id, tbl_brands.description, tbl_strings.model,\r\n\t\t\tCONCAT(tbl_gauges.usa,\"(\",tbl_gauges.diameter,\")\") as diametro FROM\r\n\t\t\trel_string_price\r\n\t\t\tINNER JOIN tbl_strings ON rel_string_price.id_strings = tbl_strings.id\r\n\t\t\tINNER JOIN tbl_brands ON tbl_strings.tbl_brands_id = tbl_brands.id\r\n\t\t\tINNER JOIN tbl_gauges ON tbl_strings.tbl_gauges_id = tbl_gauges.id\r\n\t\t\twhere rel_string_price.id_stringer = " . $this->User->UserDB->id . " \r\n\t\t\torder by tbl_brands.description, tbl_strings.model"; $command = $sqlmap->createCommand($sql); $testArray = $command->query()->readAll(); foreach ($testArray as $row) { $stringArray[$row["id"]] = $row["description"] . " " . $row["model"] . " " . $row["diametro"]; } $this->DDLStringMains->DataSource = $stringArray; $this->DDLStringMains->dataBind(); $this->DDLStringMains->SelectedValue = $job->tbl_strings_id_main; $this->WeightMains->Text = $job->weight_main; $this->PrestretchMain->Text = $job->prestretch_main; $this->DDLStringCross->DataSource = $stringArray; $this->DDLStringCross->dataBind(); $this->DDLStringCross->SelectedValue = $job->tbl_strings_id_cross; $this->WeightCross->Text = $job->wieght_cross; $this->PrestretchCross->Text = $job->prestretch_cross; if ($job->tbl_strings_id_main == $job->tbl_strings_id_cross && $job->weight_main == $job->wieght_cross) { $this->DDLStringCross->enabled = false; $this->WeightCross->enabled = false; $this->ActivateStringCross->Checked = false; } else { $this->DDLStringCross->enabled = true; $this->WeightCross->enabled = true; $this->ActivateStringCross->Checked = true; } $criteria = new TActiveRecordCriteria(); $criteria->OrdersBy['description'] = 'asc'; $stringingJobTypeArray = array(); $stringingJobType = TblStringingJobType::finder()->findAll($criteria); foreach ($stringingJobType as $row) { $stringingJobTypeArray[$row->id] = $row->description; } $this->DDLStringingType->DataSource = $stringingJobTypeArray; $this->DDLStringingType->dataBind(); $this->DDLStringingType->SelectedValue = $job->tbl_stringing_type_id; $this->DynamicTension->Text = $job->dynamic_tension; $this->DDLStencyl->SelectedValue = $job->stencyl; $this->DDLGrommetsGuard->SelectedValue = $job->grommets_guard; $criteria = new TActiveRecordCriteria(); $criteria->OrdersBy['model'] = 'asc'; $gripsArray = array(); $gripsArray[0] = Prado::localize('NoGrip'); $grips = TblGrips::finder()->findAll($criteria); foreach ($grips as $row) { $brand = TblBrands::finder()->findBy_id($row->tbl_brands_id); $row->brand_name = $brand->description; $gripsArray[$row->id] = $row->brand_name . " " . $row->model; } $this->DDLGrips->SelectedValue = 0; $this->DDLGrips->DataSource = $gripsArray; $this->DDLGrips->dataBind(); $this->DDLGrips->SelectedValue = $job->tbl_grip_id; $criteria = new TActiveRecordCriteria(); $criteria->OrdersBy['model'] = 'asc'; $overGripsArray = array(); $overGripsArray[0] = Prado::localize('NoOvergrip'); $overGrips = TblOvergrips::finder()->findAll($criteria); foreach ($overGrips as $row) { $brand = TblBrands::finder()->findBy_id($row->tbl_brands_id); $row->brand_name = $brand->description; $overGripsArray[$row->id] = $row->brand_name . " " . $row->model; } $this->DDLOvergrips->SelectedValue = 0; $this->DDLOvergrips->DataSource = $overGripsArray; $this->DDLOvergrips->dataBind(); $this->DDLOvergrips->SelectedValue = $job->tbl_overgrip_id; $this->Note->Text = $job->note; $this->TotalPrice->Text = $job->total_price; if ($clone) { $this->Broken->Checked = false; $this->Cut->Checked = false; $this->DurationString->Text = "0"; $this->NoteCustomer->Text = ""; } else { $this->Broken->Checked = $job->broken; $this->Cut->Checked = $job->cut; $this->DurationString->Text = $job->duration_string; $this->NoteCustomer->Text = $job->note_customer; } }
public function createEditZone($job, $clone) { $this->editable->Visible = true; if ($clone) { $this->DATA_JOB_TITLE->Text = Prado::localize('DataNewJob'); $this->DateStringing->setTimeStamp(strtotime("now")); } else { $this->DATA_JOB_TITLE->Text = Prado::localize('EditNewJob') . " " . $this->formatJob($job->id); $this->DateStringing->setTimeStamp(strtotime($job->date_stringing)); } $this->EDIT_RACQUET->Visible = true; $racquetUser = TblRacquetsUser::finder()->findBy_id($job->tbl_racquets_user_id); $racquet = TblRacquets::finder()->findBy_id($racquetUser->tbl_racquets_id); $brandRacquet = TblBrands::finder()->findBy_id($racquet->tbl_brands_id); $this->EDIT_RACQUET->Text = $brandRacquet->description . " " . $racquet->model . " " . $racquetUser->serial; $criteria = new TActiveRecordCriteria(); $criteria->OrdersBy['model'] = 'asc'; $striningMachineArray = array(); $striningMachine = TblStringingMachines::finder()->findAll($criteria); foreach ($striningMachine as $row) { $brand = TblBrands::finder()->findBy_id($row->tbl_brands_id); $row->brand_name = $brand->description; $striningMachineArray[$row->id] = $row->brand_name . " " . $row->model; } $this->DDLStriningMachine->DataSource = $striningMachineArray; $this->DDLStriningMachine->dataBind(); $this->DDLStriningMachine->SelectedValue = $job->tbl_stringing_machines_id; $i = 0; $brand_name = array(); $model = array(); $stringArray = array(); $string = TblStrings::finder()->findAll(); foreach ($string as $row) { $brand = TblBrands::finder()->findBy_id($row->tbl_brands_id); $row->brand_name = $brand->description; $brand_name[$i] = $row->brand_name; $model[$i] = $row->model; $i++; $gauge = TblGauges::finder()->findBy_id($row->tbl_gauges_id); $row->gauge_desc = $gauge->usa . " (" . $gauge->diameter . ")"; $stringArray[$row->id] = $row->brand_name . " " . $row->model . " " . $row->gauge_desc; } asort($stringArray); $this->DDLStringMains->DataSource = $stringArray; $this->DDLStringMains->dataBind(); $this->DDLStringMains->SelectedValue = $job->tbl_strings_id_main; $this->WeightMains->Text = $job->weight_main; $this->PrestretchMain->Text = $job->prestretch_main; $this->DDLStringCross->DataSource = $stringArray; $this->DDLStringCross->dataBind(); $this->DDLStringCross->SelectedValue = $job->tbl_strings_id_cross; $this->WeightCross->Text = $job->wieght_cross; $this->PrestretchCross->Text = $job->prestretch_cross; if ($job->tbl_strings_id_main == $job->tbl_strings_id_cross && $job->weight_main == $job->wieght_cross) { $this->DDLStringCross->enabled = false; $this->WeightCross->enabled = false; $this->ActivateStringCross->Checked = false; } else { $this->DDLStringCross->enabled = true; $this->WeightCross->enabled = true; $this->ActivateStringCross->Checked = true; } $criteria = new TActiveRecordCriteria(); $criteria->OrdersBy['description'] = 'asc'; $stringingJobTypeArray = array(); $stringingJobType = TblStringingJobType::finder()->findAll($criteria); foreach ($stringingJobType as $row) { $stringingJobTypeArray[$row->id] = $row->description; } $this->DDLStringingType->DataSource = $stringingJobTypeArray; $this->DDLStringingType->dataBind(); $this->DDLStringingType->SelectedValue = $job->tbl_stringing_type_id; $this->DynamicTension->Text = $job->dynamic_tension; $this->DDLStencyl->SelectedValue = $job->stencyl; $this->DDLGrommetsGuard->SelectedValue = $job->grommets_guard; $criteria = new TActiveRecordCriteria(); $criteria->OrdersBy['model'] = 'asc'; $gripsArray = array(); $gripsArray[0] = Prado::localize('NoGrip'); $grips = TblGrips::finder()->findAll($criteria); foreach ($grips as $row) { $brand = TblBrands::finder()->findBy_id($row->tbl_brands_id); $row->brand_name = $brand->description; $gripsArray[$row->id] = $row->brand_name . " " . $row->model; } $this->DDLGrips->SelectedValue = 0; $this->DDLGrips->DataSource = $gripsArray; $this->DDLGrips->dataBind(); $this->DDLGrips->SelectedValue = $job->tbl_grip_id; $criteria = new TActiveRecordCriteria(); $criteria->OrdersBy['model'] = 'asc'; $overGripsArray = array(); $overGripsArray[0] = Prado::localize('NoOvergrip'); $overGrips = TblOvergrips::finder()->findAll($criteria); foreach ($overGrips as $row) { $brand = TblBrands::finder()->findBy_id($row->tbl_brands_id); $row->brand_name = $brand->description; $overGripsArray[$row->id] = $row->brand_name . " " . $row->model; } $this->DDLOvergrips->SelectedValue = 0; $this->DDLOvergrips->DataSource = $overGripsArray; $this->DDLOvergrips->dataBind(); $this->DDLOvergrips->SelectedValue = $job->tbl_overgrip_id; $this->Note->Text = $job->note; $this->TotalPrice->Text = $job->total_price; if ($clone) { $this->Broken->Checked = false; $this->Cut->Checked = false; $this->DurationString->Text = "0"; $this->NoteCustomer->Text = ""; } else { $this->Broken->Checked = $job->broken; $this->Cut->Checked = $job->cut; $this->DurationString->Text = $job->duration_string; $this->NoteCustomer->Text = $job->note_customer; } }