public function createLiq(Gyuser_Model_Liquidaciones $obj, $variableDate = false) { if ($obj->getId()) { //set liq details $data = array('current_account_balance' => floatval($obj->getCurrent_account_balance()), 'amount_payed' => floatval($obj->getAmount_payed()), 'amount_debt' => floatval($obj->getAmount_debt()), 'provider_id' => $obj->getProvider_id(), 'previous_account_balance' => $obj->getPrevious_account_balance(), 'acreditacion' => $obj->getAcreditacion(), 'committed' => $obj->getCommitted(), 'credit_provider_id' => $obj->getCredit_provider_id(), 'checks_qty' => $obj->getChecks_qty(), 'average_days' => $obj->getAverage_days(), 'total_bruto' => $obj->getTotal_bruto(), 'impuesto_al_cheque_amt' => $obj->getImpuesto_al_cheque_amt(), 'intereses' => $obj->getIntereses(), 'gastos_interior_fee' => $obj->getGastos_interior_fee(), 'gastos_general_fee' => $obj->getGastos_general_fee(), 'gastos_varios' => $obj->getGastos_varios(), 'total_neto' => $obj->getTotal_neto()); if ($obj->getCommitted() == 0) { //status not consolidated but there was a variable date set $data['date'] = $obj->getDate(); $data['variable_date'] = $variableDate; } if ($obj->getCommitted() == 2) { //when setting 'en camino' status save the prov details on liq $data['date'] = $obj->getDate(); $data['variable_date'] = $variableDate; $data['date_delivered'] = $obj->getDate_delivered(); $data['tasa_anual'] = $obj->getTasa_anual(); $data['impuesto_al_cheque'] = $obj->getImpuesto_al_cheque(); $data['acreditacion_capital'] = $obj->getAcreditacion_capital(); $data['acreditacion_interior'] = $obj->getAcreditacion_interior(); $data['gastos_interior'] = $obj->getGastos_interior(); $data['gastos_general'] = $obj->getGastos_general(); $data['gastos_menor_a_monto_1'] = $obj->getGastos_cheque_menor_a_1(); $data['gastos_menor_a_1'] = $obj->getGastos_cheque_a_1(); $data['gastos_menor_a_monto_2'] = $obj->getGastos_cheque_menor_a_2(); $data['gastos_menor_a_2'] = $obj->getGastos_cheque_a_2(); } $liqId = $this->getDbTable()->update($data, array('id = ?' => $obj->getId())); } else { throw new Exception('createLiq requires an existent liq row'); } return $liqId; }