public static string SELECT(CashInfo source)
        {
            QueryConditions conditions = new QueryConditions
            {
                Caja       = source,
                CierreCaja = CierreCajaInfo.New()
            };

            return(CashLine.SELECT(conditions, true));
        }
Beispiel #2
0
        /// <summary>
        /// Copia los atributos del objeto
        /// </summary>
        /// <param name="source">Objeto origen</param>
        protected void CopyValues(CashInfo source)
        {
            if (source == null)
            {
                return;
            }

            Oid = source.Oid;
            _base.CopyValues(source);
        }
Beispiel #3
0
        private void DataPortal_Create(CriteriaCs criteria)
        {
            Random r = new Random();

            Oid = (long)r.Next();
            CopyFrom(CashInfo.Get(1, false));
            GetNewCode(1);
            OidUsuario = AppContext.User.Oid;
            Usuario    = AppContext.User.Name;
            Fecha      = DateTime.Now;
        }
Beispiel #4
0
        public static BalanceInfo Get()
        {
            BalanceInfo obj = new BalanceInfo();

            obj._pendientes_pago = PaymentSummaryList.SortList(PaymentSummaryList.GetPendientesList(), "Nombre", ListSortDirection.Ascending);

            Library.Store.QueryConditions conditions = new Library.Store.QueryConditions
            {
                TipoExpediente = ETipoExpediente.Todos,
                Estado         = EEstado.Pendiente
            };

            ExpedienteREAList expedientes = ExpedienteREAList.GetListByREA(conditions, false);

            foreach (ExpedienteREAInfo item in expedientes)
            {
                obj._pendiente_rea += item.AyudaPendiente;
            }

            OutputInvoiceList facturas = OutputInvoiceList.GetNoCobradasList(false);

            obj._pendiente_clientes          = facturas.TotalPendiente();
            obj._efectos_pte_vto_clientes    = facturas.TotalPendienteVencimiento();
            obj._efectos_negociados_clientes = facturas.TotalNegociado();
            obj._efectos_devueltos_clientes  = facturas.TotalDevuelto();

            InventarioValoradoList inventario = InventarioValoradoList.GetListStock(ETipoExpediente.Todos, null, DateTime.Today);

            foreach (InventarioValoradoInfo item in inventario)
            {
                switch (item.TipoExpediente)
                {
                case (long)(ETipoExpediente.Alimentacion):
                    obj._stock_alimentacion_valorado += item.PVP;
                    break;

                case (long)(ETipoExpediente.Ganado):
                    obj._stock_ganado_valorado += item.PVP;
                    break;

                case (long)(ETipoExpediente.Maquinaria):
                    obj._stock_maquinaria_valorado += item.PVP;
                    break;
                }
            }

            obj._saldo_caja = CashInfo.Get(1, true).SaldoTotal;

            return(obj);
        }
Beispiel #5
0
        protected virtual void CopyFrom(CashInfo source)
        {
            if (source == null)
            {
                return;
            }

            _base.CopyValues(source);

            DebeAcumulado  = source.DebeAcumulado;
            HaberAcumulado = source.HaberAcumulado;
            DebeTotal      = source.DebeTotal;
            HaberTotal     = source.HaberTotal;
        }
Beispiel #6
0
        internal void CopyValues(CashInfo source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);

            _debe_acumulado  = source.DebeAcumulado;
            _haber_acumulado = source.HaberAcumulado;
            _debe_total      = source.DebeTotal;
            _haber_total     = source.HaberTotal;
        }
Beispiel #7
0
        public virtual void CopyFrom(CashInfo source)
        {
            if (source == null)
            {
                return;
            }

            OidCaja = source.Oid;
            Debe    = source.DebeParcial;
            Haber   = source.HaberParcial;
            Caja    = source.Nombre;

            SaldoFinal = source.SaldoTotal;
        }
Beispiel #8
0
        public CashRpt GetDetailReport(CashInfo item,
                                       CashLineList list,
                                       DateTime f_ini,
                                       DateTime f_fin)
        {
            if (item == null)
            {
                return(null);
            }
            if (list.Count == 0)
            {
                return(null);
            }

            CashRpt doc = new CashRpt();

            List <CajaPrint> pList = new List <CajaPrint>();

            int index = item.Lines.IndexOf(list[0]);

            item.DebeAcumulado  = item.GetDebeAcumulado(index);
            item.HaberAcumulado = item.GetHaberAcumulado(index);

            CajaPrint obj = CajaPrint.New(item);

            List <LineaCajaPrint> pLineaCajas = new List <LineaCajaPrint>();

            obj.HaberTotal = obj.HaberAcumulado;
            obj.DebeTotal  = obj.DebeAcumulado;

            foreach (CashLineInfo child in list)
            {
                pLineaCajas.Add(LineaCajaPrint.New(child));
                if (child.EEstado != Common.EEstado.Anulado)
                {
                    obj.HaberTotal += child.Haber;
                    obj.DebeTotal  += child.Debe;
                }
            }

            pList.Add(obj);
            doc.SetDataSource(pList);
            doc.Subreports["SubLineasCaja"].SetDataSource(pLineaCajas);

            FormatHeader(doc);

            return(doc);
        }
Beispiel #9
0
 internal static string SELECT(long oid, bool lockTable)
 {
     return(SELECT(new QueryConditions {
         Caja = CashInfo.New(oid)
     }, lockTable));
 }
        protected string GetPaymentAccount(PaymentInfo payment)
        {
            string cuenta = string.Empty;
            string info   = string.Empty;

            try
            {
                switch (payment.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:
                {
                    CreditCardInfo  tarjeta = CreditCardInfo.Get(payment.OidTarjetaCredito);
                    BankAccountInfo cb      = _bank_accounts.GetItem(payment.OidCuentaBancaria);
                    cuenta = (tarjeta.ETipoTarjeta == ETipoTarjeta.Credito) ? tarjeta.CuentaContable : cb.CuentaContable;
                    info   = String.Format(Resources.Messages.CREDIT_CARD_BOOK_ACCOUNT_NOT_FOUND, tarjeta.Numeracion, tarjeta.Nombre);
                }
                break;

                case EMedioPago.CompensacionFactura:
                {
                    IAcreedorInfo provider = _providers.GetItem(payment.OidAgente, payment.ETipoAcreedor);
                    cuenta = provider.CuentaContable;
                    info   = String.Format(Resources.Messages.PROVIDER_BOOK_ACCOUNT_NOT_FOUND, provider.Codigo, provider.Nombre);
                }
                break;

                case EMedioPago.Pagare:

                    if (payment.EEstadoPago == EEstado.Pagado)
                    {
                        BankAccountInfo cb = _bank_accounts.GetItem(payment.OidCuentaBancaria);
                        cuenta = cb.CuentaContable;
                        info   = String.Format(Resources.Messages.BANK_ACCOUNT_BOOK_ACCOUNT_NOT_FOUND, cb.Valor, cb.Entidad);
                    }
                    else
                    {
                        cuenta = GetFinancialCashPaymentsAccount(payment.Vencimiento);
                    }
                    break;

                default:
                {
                    BankAccountInfo cb = _bank_accounts.GetItem(payment.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 pago nº " + payment.Codigo + " no tiene cuenta bancaria asociada");
                }
            }

            if (cuenta == string.Empty)
            {
                throw new iQException(info);
            }

            return(Convert.ToInt64(cuenta).ToString());           //Por algún motivo hay cuentas guardadas con un salto de línea al final y da problemas al exportar a contawin
        }
        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);
        }