Ejemplo n.º 1
0
 public function saveClicked()
 {
     if ($this->getViewState('machine', null) == null) {
         $this->machine = new TblStringingMachines();
     } else {
         $this->machine = $this->getViewState('machine', null);
     }
     $this->machine->tbl_brands_id = $this->DDLBrands->SelectedValue;
     $this->machine->tbl_stringing_machine_type_id = $this->DDLType->SelectedValue;
     $this->machine->model = $this->Model->Text;
     $this->machine->save();
     $personalMachine = RelStringerStringingMachine::finder()->find('id_stringer = ? AND id_stringing_machine = ?', $this->User->UserDB->id, $this->machine->id);
     if ($personalMachine == null) {
         $personalMachine = new RelStringerStringingMachine();
         $personalMachine->id_stringer = $this->User->UserDB->id;
         $personalMachine->id_stringing_machine = $this->machine->id;
     }
     $personalMachine->serial = $this->Serial->Text;
     $personalMachine->date_buy = $this->DateBuy->getDataOk();
     if ($this->ActivateDateCalibration->Checked) {
         $personalMachine->date_calibration = $this->DateCalibration->getDataOk();
     }
     $personalMachine->note = $this->Note->Text;
     if ($this->DefaultMachine->Checked) {
         $personalMachine->default = 1;
     } else {
         $personalMachine->default = 0;
     }
     $personalMachine->save();
     if ($this->DefaultMachine->Checked) {
         $arrayMachine = RelStringerStringingMachine::finder()->findAll('id_stringer = ? AND id_stringing_machine != ?', $this->User->UserDB->id, $this->machine->id);
         if ($arrayMachine != null) {
             foreach ($arrayMachine as $row) {
                 $row->default = 0;
                 $row->save();
             }
         }
     }
     $this->editable->Visible = false;
     $this->RefreshData();
     $this->DataGridMachines->SelectedItemIndex = -1;
     $this->DataGridMachines->DataSource = $this->Data;
     $this->DataGridMachines->dataBind();
     //$this->Data_uscita->setTimeStamp(strtotime("now"));
     //$pazienteStanzaLettoRecord->data_fine_validita = $this->Data_uscita->getDataOk();
 }
Ejemplo n.º 2
0
 public function createNewZone()
 {
     $this->editable->Visible = true;
     $this->EDIT_RACQUET->Visible = false;
     $this->DATA_JOB_TITLE->Text = Prado::localize('DataNewJob');
     //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();
     $firstIdCustomer = 0;
     foreach ($testArray as $row) {
         if ($firstIdCustomer == 0) {
             $firstIdCustomer = $row["id"];
         }
         $arrayClienti[$row["id"]] = $row["name"] . " " . $row["surname"];
     }
     $this->DDLCustomers->DataSource = $arrayClienti;
     $this->DDLCustomers->dataBind();
     $this->DDLCustomers->Enabled = true;
     if (count($arrayClienti) == 0) {
         $this->Response->redirect($this->Service->constructUrl('User.Customers'));
     }
     //racchette clienti
     $this->ChangeCustomersRacquets($firstIdCustomer);
     $this->DDLCustomerRacquets->Enabled = true;
     $this->DateStringing->setTimeStamp(strtotime("now"));
     $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();
     //macchina di default
     $idDefault = 1;
     $arrayPersonalMachine = RelStringerStringingMachine::finder()->findAll('id_stringer = ?', $this->User->UserDB->id);
     if ($arrayPersonalMachine != null) {
         foreach ($arrayPersonalMachine as $row) {
             if ($row->default == 1) {
                 $idDefault = $row->id_stringing_machine;
             }
         }
     }
     $this->DDLStriningMachine->SelectedValue = $idDefault;
     $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->WeightMains->Text = "0";
     $this->PrestretchMain->Text = "0";
     $this->DDLStringCross->enabled = false;
     $this->DDLStringCross->DataSource = $stringArray;
     $this->DDLStringCross->dataBind();
     $this->WeightCross->enabled = false;
     $this->WeightCross->Text = "0";
     $this->PrestretchCross->enabled = false;
     $this->PrestretchCross->Text = "0";
     $this->ActivateStringCross->Checked = false;
     $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->DynamicTension->Text = "0";
     $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();
     $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->TotalPrice->Text = "0";
     $this->Broken->Checked = false;
     $this->Cut->Checked = false;
     $this->DurationString->Text = "0";
     $this->NoteCustomer->Text = "";
 }
Ejemplo n.º 3
0
 public function createNewZone()
 {
     $this->editable->Visible = true;
     $this->EDIT_RACQUET->Visible = false;
     $this->DATA_JOB_TITLE->Text = Prado::localize('DataNewJob');
     $this->DateStringing->setTimeStamp(strtotime("now"));
     $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();
     //macchina di default
     $idDefault = 1;
     $arrayPersonalMachine = RelStringerStringingMachine::finder()->findAll('id_stringer = ?', $this->User->UserDB->id);
     if ($arrayPersonalMachine != null) {
         foreach ($arrayPersonalMachine as $row) {
             if ($row->default == 1) {
                 $idDefault = $row->id_stringing_machine;
             }
         }
     }
     $this->DDLStriningMachine->SelectedValue = $idDefault;
     $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->WeightMains->Text = "0";
     $this->PrestretchMain->Text = "0";
     $this->DDLStringCross->enabled = false;
     $this->DDLStringCross->DataSource = $stringArray;
     $this->DDLStringCross->dataBind();
     $this->WeightCross->enabled = false;
     $this->WeightCross->Text = "0";
     $this->PrestretchCross->enabled = false;
     $this->PrestretchCross->Text = "0";
     $this->ActivateStringCross->Checked = false;
     $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->DynamicTension->Text = "0";
     $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();
     $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->TotalPrice->Text = "0";
     $this->Broken->Checked = false;
     $this->Cut->Checked = false;
     $this->DurationString->Text = "0";
     $this->NoteCustomer->Text = "";
 }