I am attaching the code and the bin link http://bin.cakephp.org/view/1231114400
- /**
- Estimation Model
- **/
-
- App::uses('AppModel', 'Model');
-
- /**
- * Estimation Model
- *
- * @property Referal $Referal
- * @property Invoicing $Invoicing
- * @property Contract $Contract
- * @property SalePackage $SalePackage
- */
- class Estimation extends AppModel {
-
- /**
- * Validation rules
- *
- * @var array
- */
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- );
-
- //The Associations below have been created with all possible keys, those that are not needed can be removed
-
- /**
- * belongsTo associations
- *
- * @var array
- */
- 'className' => 'Referal',
- 'foreignKey' => 'referal_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- ),
- 'className' => 'Invoicing',
- 'foreignKey' => 'invoicing_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- )
- );
-
- /**
- * hasMany associations
- *
- * @var array
- */
- 'className' => 'Contract',
- 'foreignKey' => 'estimation_id',
- 'dependent' => false,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'exclusive' => '',
- 'finderQuery' => '',
- 'counterQuery' => ''
- ),
- 'className' => 'SalePackage',
- 'foreignKey' => 'estimation_id',
- 'dependent' => false,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'exclusive' => '',
- 'finderQuery' => '',
- 'counterQuery' => ''
- )
- );
-
- }
-
-
- /**
- Method for save data
- **/
- public function admin_add() {
- if ($this->request->is('post')) {
- //$this->Estimation->create();
- debug($this->request->data);
- if ($this->Estimation->saveAssociated($this->request->data)) {
- $this->Session->setFlash(__('The estimation has been saved'));
- /*if (isset($this->request->data['Estimation']['new']) && $this->request->data['Estimation']['new']) {
- $this->redirect(array('controller' => 'estimations', 'action' => 'add'));
- } else {
- $this->redirect(array('controller' => 'estimations', 'action' => 'view', $this->Estimation->id));
- }*/
- } else {
- $this->Session->setFlash(__('The estimation could not be saved. Please, try again.'));
- }
- }
-
-
- /**
- The result of the array debug before saving
- **/
- 'biz_name' => 'EL BANANERO',
- 'doc_type_id' => '3',
- 'doc_number' => '2141232',
- 'first_name' => 'RICARDO',
- 'last_name' => 'OVIEDO',
- 'address' => 'Arequipa',
- 'email' => 'ricardo.oviedo@open-comet.com',
- 'phone' => '',
- 'mobile' => ''
- ),
- 'date' => '2012-07-18',
- 'invoicing_id' => '1',
- 'vehicles_from' => '9',
- 'vehicles_to' => '10',
- 'expiration_days' => '10',
- 'comments' => 'Esto es una prueba',
- 'sub_total' => '40',
- 'taxes' => '7.2',
- 'total' => '47.2',
- 'new' => '0'
- ),
- 'product_id' => '1',
- 'description' => 'PRODUCTO UNO',
- 'price_package' => '10'
- ),
- 'product_id' => '1',
- 'description' => 'PRODUCTO UNO',
- 'price_package' => '10'
- ),
- 'product_id' => '1',
- 'description' => 'PRODUCTO UNO',
- 'price_package' => '10'
- ),
- 'product_id' => '1',
- 'description' => 'PRODUCTO UNO',
- 'price_package' => '10'
- )
- )
- )
-- Carlos Eduardo Sotelo Pinto GNU Linux Admin | PHP Senior Web Developer MObil: RPC (Claro)+51, 958194614 http://www.carlossotelo.com Skype: csotelop Yahoo: csotelop MSN: carlos.sotelo.pinto@gmail.com GTalk: carlos.sotelo.pinto@gmail.com GPG FP:697E FAB8 8E83 1D60 BBFB 2264 9E3D 5761 F855 4F6B GNULinux RU #379182 || GNULinux RM #277661
No comments:
Post a Comment