コード例 #1
0
ファイル: ListJobs.php プロジェクト: bailey-ann/stringtools
 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');
 }
コード例 #2
0
    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;
    }
コード例 #3
0
 public function checkPrice()
 {
     $totalPrice = 0;
     $cost = $this->User->UserDB->cost;
     $racquetCustomer = TblRacquetsUser::finder()->findBy_id($this->DDLCustomerRacquets->SelectedValue);
     $this->customer = TblUsers::finder()->findBy_id($racquetCustomer->tbl_users_id);
     $costCustomer = $this->customer->cost;
     if ($costCustomer == 0) {
         $totalPrice += $cost;
     } else {
         $totalPrice += $costCustomer;
     }
     $mainString = TblStrings::finder()->findBy_id($this->DDLStringMains->SelectedValue);
     $mainStringCost = RelStringPrice::finder()->find('id_strings = ? AND id_stringer = ?', $mainString->id, $this->User->UserDB->id);
     $costMain = $mainStringCost->price / 2;
     $totalPrice += $costMain;
     $costCross = 0;
     if (!$this->ActivateStringCross->Checked) {
         $costCross = $costMain;
     } else {
         $crossString = TblStrings::finder()->findBy_id($this->DDLStringCross->SelectedValue);
         $crossStringCost = RelStringPrice::finder()->find('id_strings = ? AND id_stringer = ?', $crossString->id, $this->User->UserDB->id);
         $costCross = $crossStringCost->price / 2;
     }
     $totalPrice += $costCross;
     if ($this->DDLGrips->SelectedValue != 0) {
         $totalPrice += TblGrips::finder()->findBy_id($this->DDLGrips->SelectedValue)->price;
     }
     if ($this->DDLOvergrips->SelectedValue != 0) {
         $totalPrice += TblOvergrips::finder()->findBy_id($this->DDLOvergrips->SelectedValue)->price;
     }
     $this->TotalPrice->Text = $totalPrice;
 }
コード例 #4
0
ファイル: Strings.php プロジェクト: bailey-ann/stringtools
 public function selectString($sender, $param)
 {
     $this->editable->Visible = true;
     $this->TypeEdit->Text = Prado::localize('Edit string');
     $this->string = TblStrings::finder()->findBy_id($param->Item->IDColumn->Text);
     $criteria = new TActiveRecordCriteria();
     $criteria->OrdersBy['description'] = 'asc';
     $brands = TblBrands::finder()->findAll($criteria);
     $this->DDLBrands->DataSource = $brands;
     $this->DDLBrands->dataBind();
     $this->DDLBrands->SelectedValue = $this->string->tbl_brands_id;
     $this->Model->Text = $this->string->model;
     $this->Code->Text = $this->string->code;
     $criteria = new TActiveRecordCriteria();
     $criteria->OrdersBy['usa'] = 'asc';
     $gauges = TblGauges::finder()->findAll($criteria);
     $gaugesArray = array();
     foreach ($gauges as $row) {
         $gaugesArray[$row->id] = $row->usa . " (" . $row->diameter . ")";
     }
     $this->DDLGauges->DataSource = $gaugesArray;
     $this->DDLGauges->dataBind();
     $this->DDLGauges->SelectedValue = $this->string->tbl_gauges_id;
     $this->ExactGauge->Text = $this->string->exact_gauge;
     $criteria = new TActiveRecordCriteria();
     $criteria->OrdersBy['description'] = 'asc';
     $type = TblStringType::finder()->findAll($criteria);
     $this->DDLType->DataSource = $type;
     $this->DDLType->dataBind();
     $this->DDLType->SelectedValue = $this->string->tbl_string_type_id;
     $this->Price->Text = "0";
     $price = RelStringPrice::finder()->find('id_stringer = ? AND id_strings = ?', $this->User->UserDB->id, $this->string->id);
     if ($price != null) {
         $this->Price->Text = $price->price;
     }
     $this->setViewState('string', $this->string);
 }