protected virtual void SetTPVAction() { TPVSelectForm form = new TPVSelectForm(this); if (form.ShowDialog(this) == DialogResult.OK) { _tpv = form.Selected as TPVInfo; _entity.OidTPV = _tpv.Oid; _entity.TPV = _tpv.Nombre; _entity.OidCuentaBancaria = _tpv.OidCuentaBancaria; _entity.CuentaBancaria = _tpv.CuentaBancaria; _entity.CalculaGastos(_tpv); Cuenta_TB.Text = _entity.CuentaBancaria; TPV_TB.Text = _entity.TPV; GastosBancarios_NTB.Text = _entity.GastosBancarios.ToString("N2"); } }
protected string GetChargeAccount(ChargeInfo charge) { string cuenta = string.Empty; string info = string.Empty; try { switch (charge.EMedioPago) { case EMedioPago.Efectivo: CashInfo caja = CashInfo.Get(1); cuenta = caja.CuentaContable; info = String.Format(Resources.Messages.CASH_BOOK_ACCOUNT_NOT_FOUND, caja.Codigo, caja.Nombre); break; case EMedioPago.Tarjeta: if (Invoice.ModulePrincipal.GetUseTPVCountSetting()) { TPVInfo tpv = TPVInfo.Get(charge.OidTPV); cuenta = tpv.CuentaContable; info = tpv.Nombre; info = String.Format(Resources.Messages.TPV_BOOK_ACCOUNT_NOT_FOUND, tpv.Nombre); } else { BankAccountInfo cb = _bank_accounts.GetItem(charge.OidCuentaBancaria); cuenta = cb.CuentaContable; info = String.Format(Resources.Messages.BANK_ACCOUNT_BOOK_ACCOUNT_NOT_FOUND, cb.Valor, cb.Entidad); } break; case EMedioPago.CompensacionFactura: ClienteInfo client = _clients.GetItem(charge.OidCliente); cuenta = client.CuentaContable; info = String.Format(Resources.Messages.CLIENT_BOOK_ACCOUNT_NOT_FOUND, client.Codigo, client.Nombre); break; case EMedioPago.Pagare: case EMedioPago.Cheque: { FinancialCashInfo efecto = FinancialCashInfo.GetByCobro(charge, false); if (efecto.EEstadoCobro == EEstado.Charged) { BankAccountInfo cb = _bank_accounts.GetItem(efecto.OidCuentaBancaria); cuenta = cb.CuentaContable; info = String.Format(Resources.Messages.BANK_ACCOUNT_BOOK_ACCOUNT_NOT_FOUND, cb.Valor, cb.Entidad); } else { cuenta = GetFinancialCashChargesAccount(efecto.Vencimiento); } } break; default: { BankAccountInfo cb = _bank_accounts.GetItem(charge.OidCuentaBancaria); cuenta = cb.CuentaContable; info = String.Format(Resources.Messages.BANK_ACCOUNT_BOOK_ACCOUNT_NOT_FOUND, cb.Valor, cb.Entidad); } break; } } catch (Exception ex) { if (ex is iQException) { throw ex; } else { throw new iQException("El cobro nº " + charge.Codigo + " no tiene cuenta bancaria asociada"); } } if (cuenta == string.Empty) { throw new iQException(info); } return(cuenta); }
protected virtual void SetPaymentMethodAction() { SelectEnumInputForm form = new SelectEnumInputForm(true); form.SetDataSource(Library.Common.EnumText <EMedioPago> .GetList(false)); try { Datos.RaiseListChangedEvents = false; if (form.ShowDialog(this) == DialogResult.OK) { ComboBoxSource item = form.Selected as ComboBoxSource; _entity.SetMedioPago(item.Oid); MedioPago_TB.Text = _entity.EMedioPagoLabel; Importe_NTB.Enabled = true; TPV_BT.Enabled = false; Cuenta_BT.Enabled = true; EstadoCobro_BT.Enabled = false; _tpv = (_entity.EMedioPago != EMedioPago.Tarjeta) ? null : _tpv; _entity.OidTPV = 0; _entity.TPV = string.Empty; switch (_entity.EMedioPago) { case EMedioPago.CompensacionFactura: { Importe_NTB.Text = _entity.Importe.ToString("N2"); UnlinkAllAction(); Importe_NTB.Enabled = false; EstadoCobro_BT.Enabled = false; } break; case EMedioPago.Tarjeta: { TPV_BT.Enabled = true; Cuenta_BT.Enabled = false; EstadoCobro_BT.Enabled = false; } break; case EMedioPago.Pagare: EstadoCobro_BT.Enabled = true; break; } if (Library.Common.EnumFunctions.NeedsCuentaBancaria(_entity.EMedioPago)) { if ((_entity.EMedioPago == EMedioPago.Tarjeta) && (_entity.OidTPV == 0)) { SetTPVAction(); } else if (_entity.OidCuentaBancaria == 0) { SetBankAccountAction(); } } else { Cuenta_TB.Text = string.Empty; } } EstadoCobro_TB.Text = _entity.EstadoCobroLabel; } finally { Datos.RaiseListChangedEvents = true; } }