internal void UpdateTipo(ETipoAcreedor oldProviderType)
        {
            CriteriaEx criteria = Proveedor.GetCriteria(SessionCode);

            QueryConditions conditions = new QueryConditions
            {
                Acreedor     = this.GetInfo(false),
                TipoAcreedor = new ETipoAcreedor[1] {
                    oldProviderType
                },
                PaymentType = ETipoPago.Factura
            };

            criteria.Query = InputDelivery.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);

            criteria.Query = InputInvoiceSQL.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);

            criteria.Query = ProductoProveedor.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);

            //PagoFactura antes que Pago porque si modificamos el tipo del pago antes luego no coinciden
            criteria.Query = TransactionPayment.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);

            criteria.Query = Payment.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);
        }
Beispiel #2
0
        public static void CreateCreditCardStatementsPayments()
        {
            Payments       statement_payments = Payments.GetCreditCardStatementsList(0, false);
            CreditCardList credit_cards       = CreditCardList.GetList(false);

            foreach (Payment payment in statement_payments)
            {
                //Payment Transactions
                payment.LoadChilds(typeof(TransactionPayment), false);

                CreditCardInfo card = credit_cards.GetItem(payment.OidTarjetaCredito);

                if (card.ETipoTarjeta != ETipoTarjeta.Credito)
                {
                    continue;
                }

                //Extractos
                if (card.Statements == null)
                {
                    card.LoadChilds(typeof(CreditCardStatement), false);
                }

                foreach (CreditCardStatementInfo statement in card.Statements)
                {
                    if (statement.Amount == payment.Importe && statement.DueDate == payment.Vencimiento)
                    {
                        TransactionPayment operation = payment.Operations.NewItem(payment, statement, ETipoPago.ExtractoTarjeta);
                        operation.Cantidad = payment.Importe;
                    }
                }
            }

            statement_payments.Save();
        }
Beispiel #3
0
        public static TransactionPaymentList GetList(QueryConditions conditions, bool childs)
        {
            CriteriaEx criteria = TransactionPayment.GetCriteria(TransactionPayment.OpenSession());

            criteria.Childs = childs;

            criteria.Query = TransactionPaymentList.SELECT(conditions);

            TransactionPaymentList list = DataPortal.Fetch <TransactionPaymentList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
        internal void CopyValues(TransactionPayment source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source._base.Record);

            _n_serie         = source.NSerie;
            _fecha_factura   = source.FechaFactura;
            _n_factura       = source.NFactura;
            _importe_factura = source.ImporteFactura;
            _n_expediente    = source.NExpediente;
            _other_payments  = source.OtherPayments;
        }
Beispiel #5
0
        public static TransactionPaymentList GetListByFactura(long oid_factura)
        {
            CriteriaEx criteria = TransactionPayment.GetCriteria(TransactionPayment.OpenSession());

            criteria.Childs = false;

            Library.Store.QueryConditions conditions = new Library.Store.QueryConditions {
                FacturaRecibida = InputInvoice.New().GetInfo()
            };
            conditions.FacturaRecibida.Oid = oid_factura;
            criteria.Query = TransactionPaymentList.SELECT(conditions);

            TransactionPaymentList list = DataPortal.Fetch <TransactionPaymentList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
Beispiel #6
0
        public static void CreateApuntesBancarios(PaymentList pagos)
        {
            List <PaymentInfo> list = new List <PaymentInfo>();

            CreditCardList tarjetas      = CreditCardList.GetList();
            Payments       pagos_tarjeta = Payments.NewList();

            foreach (PaymentInfo item in pagos)
            {
                if (!Common.EnumFunctions.NeedsCuentaBancaria(item.EMedioPago))
                {
                    continue;
                }
                if (item.Vencimiento > DateTime.Today)
                {
                    continue;
                }

                if (item.EMedioPago != EMedioPago.Tarjeta)
                {
                    //Apunte bancario del pagaré, talón, etc..
                    BankLine.BankLine.InsertItem(item, true);

                    list.Add(item);
                }
                else
                {
                    Payment pago_tarjeta = pagos_tarjeta.GetItemByTarjetaCredito(item.OidTarjetaCredito, item.Vencimiento);

                    if (pago_tarjeta == null)
                    {
                        pago_tarjeta = pagos_tarjeta.NewItem(item, ETipoPago.ExtractoTarjeta);
                        TransactionPayment pf = pago_tarjeta.Operations.NewItem(pago_tarjeta, item, item.ETipoPago);
                        pf.Cantidad = item.Total;
                        pago_tarjeta.EEstadoPago = EEstado.Pagado;
                    }
                    else
                    {
                        pago_tarjeta.Importe         += item.Importe;
                        pago_tarjeta.GastosBancarios += item.GastosBancarios;
                        TransactionPayment pf = pago_tarjeta.Operations.NewItem(pago_tarjeta, item, item.ETipoPago);
                        pf.Cantidad = item.Total;
                    }

                    list.Add(item);
                }
            }

            Payments pagos_fraccionados = Payments.NewList();

            pagos_fraccionados.OpenNewSession();

            //Apunte bancario de la tarjeta
            foreach (Payment item in pagos_tarjeta)
            {
                Payment root = pagos_fraccionados.NewItem(item.GetInfo(false), ETipoPago.FraccionadoTarjeta);
                root.Pagos.AddItem(item);

                //if (item.Importe != 0)
                //    MovimientoBanco.InsertItemTarjeta(item, tarjetas.GetItem(item.OidTarjetaCredito));
            }

            pagos_fraccionados.BeginTransaction();
            pagos_fraccionados.Save();

            Payment.UpdatePagadoFromList(list, true);
        }
Beispiel #7
0
 public static string SELECT(Library.Store.QueryConditions conditions)
 {
     return(TransactionPayment.SELECT(conditions, false));
 }