public function savepaymentforrejectedchequeajaxAction() { try { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); if ($this->getRequest()->isPost()) { $paymentType = $request->payment_type; switch ($paymentType) { case 1: $Obj = new Gyuser_Model_Cobranzas(); $Obj->setClient_id($request->client_id); $Obj->setOperation_id($request->operation_id); $Obj->setCheque_id($request->cheque_id); $Obj->setDate_paid($request->date_paid); $Obj->setPaid_amount($request->paid_amount); $Obj->setPrevious_balance($request->previous_balance); $Obj->setCurrent_balance($request->current_balance); $Obj->setPayment_type($request->payment_type); break; case 2: $Obj = new Gyuser_Model_Cobranzas(); $Obj->setClient_id($request->client_id); $Obj->setOperation_id($request->operation_id); $Obj->setCheque_id($request->cheque_id); $Obj->setDate_paid($request->date_paid); $Obj->setPaid_amount($request->paid_amount); $Obj->setPrevious_balance($request->previous_balance); $Obj->setCurrent_balance($request->current_balance); $Obj->setPayment_type($request->payment_type); $chqObj = new Gyuser_Model_Cheques(); $chqObj->setAmount($request->paid_amount); $chqObj->setStatus(1); $chqObj->setRejected_bank_id($request->rejected_bank_id); $chqObj->setOperation_id($request->operation_id); $chqObj->setClient_id($request->client_id); $chqObj->setCheck_n($request->new_cheque_n); $chqObj->setDate($request->cheque_date); $chqObj->setRejected_check_payment(1); $Obj->setCheques_obj($chqObj); break; case 3: $Obj = new Gyuser_Model_Cobranzas(); $Obj->setClient_id($request->client_id); $Obj->setOperation_id($request->operation_id); $Obj->setCheque_id($request->cheque_id); $Obj->setDate_paid($request->date_paid); $Obj->setPaid_amount($request->paid_amount); $Obj->setPrevious_balance($request->previous_balance); $Obj->setCurrent_balance($request->current_balance); $Obj->setPayment_type($request->payment_type); $chqObj = new Gyuser_Model_Cheques(); $chqObj->setAmount($request->paid_amount); $chqObj->setStatus(1); $chqObj->setOperation_id($request->operation_id); $chqObj->setClient_id($request->client_id); $chqObj->setCheck_n($request->new_cheque_n); $chqObj->setDate($request->cheque_date); $chqObj->setRejected_check_payment(2); $Obj->setCheques_obj($chqObj); $bankObj = new Gyuser_Model_BankAccounts(); $bankObj->setUser_id($request->client_id); $bankObj->setBank_name($request->bank_name); $bankObj->setBranch($request->branch); $bankObj->setAccount_n($request->account_n); $bankObj->setOpening_date($request->opening_date); $bankObj->setZip_code($request->check_zip_code); $bankObj->setLocation_capital($request->location_capital); $Obj->setBank_accounts_obj($bankObj); break; } $mapper = new Gyuser_Model_CobranzasDataMapper(); $id = $mapper->SavePaymentForRejectedCheque($Obj); echo $id; } } catch (Exception $e) { echo $e; } }