Ejemplo n.º 1
0
        protected void CopyValues(OutputInvoiceInfo factura, ClienteInfo cliente, TransporterInfo transporte, SerieInfo serie, bool get_QRCode)
        {
            if (factura == null)
            {
                return;
            }

            _base.CopyValues(factura);

            if (cliente != null)
            {
                _base._id_cliente = cliente.Codigo;
                _telefonos        = cliente.Telefonos;
                _fax = cliente.Fax;
            }

            if (transporte != null)
            {
                _nombre_transportista = transporte.Nombre;
            }

            if (serie != null)
            {
                _serie         = serie.Identificador;
                _nombre_serie  = serie.Nombre;
                _base._n_serie = serie.Identificador;
            }

            _conceptos = factura.ConceptoFacturas;

            if (get_QRCode)
            {
                _qr_code_print.LoadQRCode(_qr_code_print.Encode(QREncodeVersion.v1, ETipoEntidad.FacturaEmitida, this), QRCodeVersion.v8);
            }
        }
        /// <summary>
        /// Copia los atributos del objeto
        /// </summary>
        /// <param name="source">Objeto origen</param>
        protected void CopyValues(AlbaranFacturaInfo source, ClienteInfo cliente, OutputInvoiceInfo factura, OutputDeliveryInfo Albaran)
        {
            if (source == null)
            {
                return;
            }

            Oid = source.Oid;
            _base.Record.OidAlbaran = source.OidAlbaran;
            _base.Record.OidFactura = source.OidFactura;

            SerieInfo serie = SerieInfo.Get(factura.OidSerie, false);

            _base.CodigoFactura = factura.Codigo;
            _total_factura      = factura.Total;
            _numero_serie       = serie.Identificador;
            _fecha_factura      = factura.Fecha;
            _prevision          = factura.Prevision;

            //INNER JOIN
            _codigo_cliente = cliente.Codigo;
            _nombre         = cliente.Nombre;
            _telefonos      = cliente.Telefonos;
            _movil          = cliente.Movil;
            _dias_pago      = Albaran.Fecha.Subtract(factura.Fecha).Days;
        }
        protected void CopyValues(ClienteInfo source, OutputInvoiceInfo factura)
        {
            if (source == null)
            {
                return;
            }

            if (factura != null)
            {
                _oid_factura             = factura.Oid;
                _numero_factura          = factura.Codigo;
                _numero_serie            = factura.NumeroSerie;
                _fecha_factura           = factura.Fecha;
                _total_factura           = factura.Total;
                _prevision               = factura.Prevision;
                _cantidad_cobrada        = factura.Cobrado;
                _pendiente               = factura.Pendiente;
                _efectos_negociados      = factura.EfectosNegociados;
                _efectos_devueltos       = factura.EfectosDevueltos;
                _efectos_pendientes_vto  = factura.EfectosPendientesVto;
                _gastos_cobro            = factura.GastosCobro;
                _base.Record.TipoInteres = factura.TipoInteres;
            }
            else
            {
                _numero_factura          = "";
                _numero_serie            = "";
                _total_factura           = 0;
                _base.Record.TipoInteres = 0;
            }

            Oid = source.Oid;
            _base.CopyValues(source);
        }
        public virtual void CopyFrom(Charge cobro, OutputInvoiceInfo factura)
        {
            OidCobro        = cobro.Oid;
            OidFactura      = factura.Oid;
            Cantidad        = factura.Asignado;
            FechaAsignacion = DateTime.Now;

            FechaPrevision = factura.Prevision;
            ImporteFactura = factura.Total;
        }
Ejemplo n.º 5
0
        public static OutputDeliveryList GetListByFactura(bool childs, long oidInvoice, DateTime from, DateTime till)
        {
            QueryConditions conditions = new QueryConditions
            {
                TipoEntidad = ETipoEntidad.Cliente,
                Factura     = OutputInvoiceInfo.New(oidInvoice),
                FechaIni    = from,
                FechaFin    = till
            };

            return(GetList(false, SELECT(conditions)));
        }
        public static CobroFactura NewChild(OutputInvoiceInfo parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            CobroFactura obj = new CobroFactura();

            obj.OidFactura = parent.Oid;

            return(obj);
        }
        public static CobroFacturaList GetChildList(OutputInvoiceInfo parent, bool childs)
        {
            CriteriaEx criteria = CobroFactura.GetCriteria(OutputInvoice.OpenSession());

            criteria.Query  = CobroFacturaList.SELECT_BY_FACTURA(parent.Oid);
            criteria.Childs = childs;

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

            list.CloseSession();

            return(list);
        }
        public static CobroFactura NewChild(Charge parent, OutputInvoiceInfo factura)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            CobroFactura obj = new CobroFactura();

            obj.CopyFrom(parent, factura);

            return(obj);
        }
        public static OutputInvoiceLineList GetChildList(OutputInvoiceInfo parent, bool childs)
        {
            CriteriaEx criteria = OutputInvoiceLine.GetCriteria(OutputInvoiceLine.OpenSession());

            criteria.Query  = SELECT(parent);
            criteria.Childs = childs;

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

            list.CloseSession();

            return(list);
        }
Ejemplo n.º 10
0
        protected void CopyValues(CobroFacturaInfo source, ClienteInfo cliente, OutputInvoiceInfo factura)
        {
            if (source == null)
            {
                return;
            }

            CopyValues(source);

            if (factura != null)
            {
                SerieInfo serie = SerieInfo.Get(factura.OidSerie, false);

                _base.CodigoFactura = serie.Identificador + "/" + factura.Codigo;
                _total_factura      = factura.Total;
                _numero_serie       = serie.Identificador;
                _base.FechaFactura  = factura.Fecha;
                _prevision          = factura.Prevision;
                _base.Cliente       = factura.Cliente;

                if (factura.CobroFacturas != null)
                {
                    _cantidad_cobrada = 0;
                    _pendiente        = _total_factura - source.Cantidad;

                    foreach (CobroFacturaInfo item in factura.CobroFacturas)
                    {
                        if (item.Fecha < source.Fecha)
                        {
                            _cantidad_cobrada += item.Cantidad;
                            _pendiente        -= item.Cantidad;
                        }
                    }
                }
                else
                {
                    _cantidad_cobrada = factura.Cobrado;
                    _pendiente        = factura.Pendiente;
                }

                _codigo_cliente = factura.IDCliente;
                _id_cobro_label = _codigo_cliente + "/" + _base.IdCobro.ToString(Resources.Defaults.COBRO_ID_FORMAT);
            }

            if (cliente != null)
            {
                _codigo_cliente = cliente.Codigo;
                _base.Cliente   = cliente.Nombre;
                _id_cobro_label = _codigo_cliente + "/" + _base.IdCobro.ToString(Resources.Defaults.COBRO_ID_FORMAT);
            }
        }
Ejemplo n.º 11
0
        protected void CopyValues(OutputInvoiceInfo source)
        {
            if (source == null)
            {
                return;
            }

            _oid_titular        = source.OidCliente;
            _id_titular         = source.IDCliente;
            _vat_number_titular = source.VatNumber;
            _titular            = source.Cliente;
            _tipo_titular       = (long)ETipoTitular.Cliente;
            _total          = source.Total;
            _total_efectivo = source.BaseImponible;
        }
Ejemplo n.º 12
0
 public CarteraClientesPrint GetCarteraPrintObject(OutputInvoiceInfo factura)
 {
     return(CarteraClientesPrint.New(this, factura));
 }
Ejemplo n.º 13
0
        public ReportClass GetDetailReport(OutputInvoiceInfo item,
                                           SerieInfo serie,
                                           ClienteInfo cliente,
                                           TransporterInfo transporter,
                                           FormatConfFacturaAlbaranReport conf)
        {
            if (item == null)
            {
                return(null);
            }

            List <OutputInvoiceLinePrint> conceptos = new List <OutputInvoiceLinePrint>();
            List <OutputInvoicePrint>     pList     = new List <OutputInvoicePrint>();

            foreach (OutputInvoiceLineInfo cfi in item.ConceptoFacturas)
            {
                conceptos.Add(cfi.GetPrintObject());
            }

            //Si no existen conceptos, no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (conceptos.Count <= 0)
            {
                return(null);
            }

            pList.Add(OutputInvoicePrint.New(item, cliente, transporter, serie));

            ProductList productos = ProductList.GetList(false);

            foreach (OutputInvoiceLinePrint cfp in conceptos)
            {
                if (cfp.OidProducto == 0)
                {
                    continue;
                }

                ProductInfo prod = productos.GetItem(cfp.OidProducto);
                if (prod != null)
                {
                    continue;
                }

                if (prod.AyudaKilo > 0)
                {
                    cfp.Concepto += " *";
                }
            }

            List <ImpuestoResumen> impuestos = new List <ImpuestoResumen>();

            foreach (DictionaryEntry impuesto in item.GetImpuestos())
            {
                impuestos.Add((ImpuestoResumen)impuesto.Value);
            }

            ReportClass doc = null;

            try
            {
                doc = GetReportFromName("Invoice", "OutputInvoiceRpt");
            }
            catch
            {
                doc = new OutputInvoiceRpt();
            }

            doc.SetDataSource(pList);
            doc.Subreports["ConceptosRpt"].SetDataSource(conceptos);

            if (doc.Subreports["ImpuestoResumenRpt"] != null)
            {
                doc.Subreports["ImpuestoResumenRpt"].SetDataSource(impuestos);
            }

            Library.Common.CompanyInfo empresa = Library.Common.CompanyInfo.Get(Schema.Oid, false);
            doc.SetParameterValue("nombreEmpresa", empresa.Name);
            doc.SetParameterValue("dirEmpresa", empresa.Direccion);
            doc.SetParameterValue("dir2Empresa", empresa.CodPostal + ". " + empresa.Municipio + ". " + empresa.Provincia);
            doc.SetParameterValue("CIFEmpresa", empresa.VatNumber);
            doc.SetParameterValue("TlfEmpresa", empresa.Telefonos);
            doc.SetParameterValue("FaxEmpresa", empresa.Fax);
            doc.SetParameterValue("WebEmpresa", empresa.Url);
            doc.SetParameterValue("nota", conf.nota);
            doc.SetParameterValue("ACuenta", (item.CobroFacturas != null) ? item.CobroFacturas.GetTotal() : 0);
            doc.SetParameterValue("CPEmpresa", empresa.CodPostal);
            doc.SetParameterValue("municipioEmpresa", empresa.Municipio);

            return(doc);
        }
Ejemplo n.º 14
0
 public CobroFactura NewItem(OutputInvoiceInfo parent)
 {
     this.AddItem(CobroFactura.NewChild(parent));
     return(this[Count - 1]);
 }
Ejemplo n.º 15
0
 public CobroFactura NewItem(Charge parent, OutputInvoiceInfo factura)
 {
     this.AddItem(CobroFactura.NewChild(parent, factura));
     return(this[Count - 1]);
 }
Ejemplo n.º 16
0
 public static string SELECT(OutputInvoiceInfo source)
 {
     return(SELECT(new QueryConditions {
         Factura = source
     }));
 }
 protected virtual void BuildTaxBookRepercutidoAccountingEntry(OutputInvoiceInfo factura)
 {
     throw new iQImplementationException("ContabilidadExporterBase::BuildTaxBookRepercutidoAccountingEntry");
 }
 protected virtual void BuildOutputInvoiceAccountingEntry(OutputInvoiceInfo factura, LineaRegistro lr)
 {
     throw new iQImplementationException("ContabilidadExporterBase::BuildOutputInvoiceAccountingEntry");
 }
        /// <summary>
        /// FORMATO: 9999999|G|01/10/2009||VENTAS DIA|4300000001|||||||||VENTAS P.S. DEL DIA|D| |37800| |7050000001|00000|00000|00000|4|001| |36000|500| |1800| |0|4777000000|0| | |0|0| |0| |0| | | | |0|0| |0| |0| | | | |0|0| |0| |0| | | | |0|0| |0| |0| | | | |0|0| |0| |0| | | | | | | | | | |1234| | | |0
        /// </summary>
        /// <param name="factura"></param>
        protected override void BuildOutputInvoiceAccountingEntry(OutputInvoiceInfo factura, LineaRegistro lr)
        {
            ClienteInfo titular = _clients.GetItem(factura.OidCliente);

            if (titular.CuentaContable == string.Empty)
            {
                throw new iQException("El cliente nº " + titular.NumeroClienteLabel + " (" + titular.Nombre + ") no tiene cuenta contable asociada");
            }

            string apunte      = string.Empty;
            string descripcion = "Fra. " + factura.NFactura + " (" + factura.Cliente + ")";

            string tipo    = (factura.Rectificativa) ? "H" : "D";
            string signo   = (factura.Rectificativa) ? "-" : "+";
            string importe = factura.Total.ToString().Replace(".", string.Empty);

            //apunte en la cuenta del cliente
            apunte += AddValue(_config.Empresa);                                /*CENTRO DE TRABAJO*/
            apunte += AddValue("S");                                            /*TIPO DE REGISTRO*/
            apunte += AddValue(factura.Fecha.ToShortDateString());              /*FECHA*/
            apunte += AddValue(factura.NumeroSerie);                            /*Nº SERIE DOCUMENTO*/
            apunte += AddValue(factura.NFactura);                               /*DOCUMENTO*/
            apunte += AddValue(titular.CuentaContable);                         /*CUENTA*/
            apunte += AddEmptyValue(8);                                         /*SIN USO*/
            apunte += AddValue(descripcion);                                    /*DESCRIPCION*/
            apunte += AddValue(tipo.ToString());                                /*TIPO: DEBE=1, HABER=2*/
            apunte += AddValue(signo);                                          /*SIGNO*/
            apunte += AddValue(importe);                                        /*IMPORTE*/
            apunte += AddValue(_accounting_entry.ToString());                   /*ASIENTO*/
            apunte += AddEmptyValue(73);                                        /*SIN USO*/
            apunte += AddValue(_config.CentroTrabajo);                          /*CENTRO TRABAJO*/
            apunte += AddEmptyValue(3);                                         /*SIN USO*/

            _export_file.WriteLine(apunte);

            List <CuentaResumen> cuentas = factura.GetCuentas();
            FamiliaInfo          familia;

            foreach (CuentaResumen cr in cuentas)
            {
                apunte = string.Empty;

                familia = _families.GetItem(cr.OidFamilia);

                if (familia == null)
                {
                    throw new iQException("Factura " + factura.NFactura + " con familia a nulo");
                }

                if (cr.CuentaContable == string.Empty)
                {
                    throw new iQException("La familia nº " + familia.Codigo + " (" + familia.Nombre + ") no tiene cuenta contable (venta) asociada");
                }

                tipo    = (factura.Rectificativa) ? "D" : "H";
                signo   = (factura.Rectificativa) ? "+" : "-";
                importe = cr.Importe.ToString().Replace(".", string.Empty);

                //apunte en la cuenta de venta
                apunte += AddValue(_config.Empresa);                                    /*CODIGO DE EMPRESA*/
                apunte += AddValue("G");                                                /*TIPO DE REGISTRO*/
                apunte += AddValue(factura.Fecha.ToShortDateString());                  /*FECHA*/
                apunte += AddValue(factura.NumeroSerie);                                /*Nº SERIE DOCUMENTO*/
                apunte += AddValue(factura.NFactura);                                   /*DOCUMENTO*/
                apunte += AddValue(cr.CuentaContable);                                  /*CUENTA*/
                apunte += AddEmptyValue(8);                                             /*SIN USO*/
                apunte += AddValue(descripcion);                                        /*DESCRIPCION*/
                apunte += AddValue(tipo.ToString());                                    /*TIPO: DEBE=1, HABER=2*/
                apunte += AddValue(signo);                                              /*SIGNO*/
                apunte += AddValue(importe);                                            /*IMPORTE*/
                apunte += AddValue(_accounting_entry.ToString());                       /*ASIENTO*/
                apunte += AddEmptyValue(73);                                            /*SIN USO*/
                apunte += AddValue(_config.CentroTrabajo);                              /*CENTRO TRABAJO*/
                apunte += AddEmptyValue(3);                                             /*SIN USO*/

                _export_file.WriteLine(apunte);
            }

            // Apuntes en las cuentas de Impuestos

            List <ImpuestoResumen> impuestos = new List <ImpuestoResumen>();

            foreach (DictionaryEntry impuesto in factura.GetImpuestos())
            {
                impuestos.Add((ImpuestoResumen)impuesto.Value);
            }

            foreach (ImpuestoResumen ir in impuestos)
            {
                if (ir.Importe == 0)
                {
                    continue;
                }

                apunte = string.Empty;

                ImpuestoInfo impuesto = _taxes.GetItem(ir.OidImpuesto);

                if (impuesto == null)
                {
                    throw new iQException("Factura " + factura.NFactura + " con impuesto a nulo");
                }

                if (impuesto.CuentaContableSoportado == string.Empty)
                {
                    throw new iQException("El impuesto '" + impuesto.Nombre + "' no tiene cuenta contable (repercutido) asociada");
                }

                tipo    = (factura.Rectificativa) ? "D" : "H";
                signo   = (factura.Rectificativa) ? "+" : "-";
                importe = ir.Importe.ToString().Replace(".", string.Empty);

                //apunte en la cuenta del impuesto
                apunte += AddValue(_config.Empresa);                                    /*CODIGO DE EMPRESA*/
                apunte += AddValue("G");                                                /*TIPO DE REGISTRO*/
                apunte += AddValue(factura.Fecha.ToShortDateString());                  /*FECHA*/
                apunte += AddValue(factura.NumeroSerie);                                /*Nº SERIE DOCUMENTO*/
                apunte += AddValue(factura.NFactura);                                   /*DOCUMENTO*/
                apunte += AddValue(impuesto.CuentaContableSoportado);                   /*CUENTA*/
                apunte += AddEmptyValue(8);                                             /*SIN USO*/
                apunte += AddValue(descripcion);                                        /*DESCRIPCION*/
                apunte += AddValue(tipo.ToString());                                    /*TIPO: DEBE=1, HABER=2*/
                apunte += AddValue(signo);                                              /*SIGNO*/
                apunte += AddValue(importe);                                            /*IMPORTE*/
                apunte += AddValue(_accounting_entry.ToString());                       /*ASIENTO*/
                apunte += AddEmptyValue(73);                                            /*SIN USO*/
                apunte += AddValue(_config.CentroTrabajo);                              /*CENTRO TRABAJO*/
                apunte += AddEmptyValue(3);                                             /*SIN USO*/

                _export_file.WriteLine(apunte);
            }
        }
 public static string SELECT(OutputInvoiceInfo item)
 {
     return(SELECT(new Library.Invoice.QueryConditions {
         Factura = item
     }));
 }
 /// <summary>
 /// FORMATO:
 /// </summary>
 /// <param name="factura"></param>
 protected override void BuildTaxBookRepercutidoAccountingEntry(OutputInvoiceInfo factura)
 {
 }