protected void CopyValues(OutputDeliveryInfo delivery, ClienteInfo client, TransporterInfo transporter)
        {
            if (delivery == null)
            {
                return;
            }

            Oid = delivery.Oid;
            _base.CopyValues(delivery);

            if (client != null)
            {
                _base._id_cliente = client.Codigo;
                _base._cliente    = client.Nombre;
                _direccion        = client.Direccion;
                _poblacion        = client.Poblacion;
                _provincia        = client.Provincia;
                _telefonos        = client.Telefonos;
                _fax           = client.Fax;
                _municipio     = client.Municipio;
                _codigo_postal = client.CodigoPostal;
            }

            if (transporter != null)
            {
                _nombre_transportista = transporter.Nombre;
            }
        }
Esempio n. 2
0
 public void Remove(Ticket factura, OutputDeliveryInfo albaran)
 {
     foreach (AlbaranTicket item in this)
     {
         if (item.OidTicket == factura.Oid && item.OidAlbaran == albaran.Oid)
         {
             this.Remove(item.Oid);
             factura.SetAlbaranes();
             break;
         }
     }
 }
Esempio n. 3
0
 public void Remove(OutputInvoice factura, OutputDeliveryInfo albaran)
 {
     foreach (AlbaranFactura item in this)
     {
         if (item.OidFactura == factura.Oid && item.OidAlbaran == albaran.Oid)
         {
             this.Remove(item.Oid);
             factura.SetAlbaranes();
             break;
         }
     }
 }
Esempio n. 4
0
        public static OutputDeliveryLineList GetChildList(OutputDeliveryInfo parent, bool childs)
        {
            CriteriaEx criteria = OutputDeliveryLine.GetCriteria(OutputDeliveryLine.OpenSession());

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

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

            CloseSession(criteria.SessionCode);

            return(list);
        }
        public ReportClass GetDetailReport(OutputDeliveryInfo item, FormatConfFacturaAlbaranReport conf)
        {
            if (item == null)
            {
                return(null);
            }

            List <OutputDeliveryLinePrint> conceptos = new List <OutputDeliveryLinePrint>();
            List <OutputDeliveryPrint>     pList     = new List <OutputDeliveryPrint>();

            foreach (OutputDeliveryLineInfo cfi in item.Conceptos)
            {
                conceptos.Add(OutputDeliveryLinePrint.New(cfi));
            }

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

            pList.Add(item.GetPrintObject());

            ReportClass doc = null;

            try
            {
                doc = GetReportFromName("Delivery", "OutputDeliveryRpt");
            }
            catch
            {
                doc = new OutputDeliveryRpt();
            }

            doc.SetDataSource(pList);
            doc.Subreports["LinesClientCopy"].SetDataSource(conceptos);
            //doc.Subreports["LinesCompanyCopy"].SetDataSource(conceptos);

            CompanyInfo empresa = CompanyInfo.Get(Schema.Oid);

            doc.SetParameterValue("nombreEmpresa", empresa.Name);
            doc.SetParameterValue("dirEmpresa", empresa.Direccion);
            doc.SetParameterValue("CIFEmpresa", empresa.VatNumber);
            doc.SetParameterValue("nota", conf.nota);
            doc.SetParameterValue("CPEmpresa", empresa.CodPostal);
            doc.SetParameterValue("municipioEmpresa", empresa.Municipio);
            doc.SetParameterValue("TlfEmpresa", empresa.Telefonos);
            doc.SetParameterValue("WebEmpresa", empresa.Url);

            return(doc);
        }
        public ReportClass GetWorkDelivery(OutputDeliveryInfo item, ExpedientInfo work)
        {
            if (item == null)
            {
                return(null);
            }

            List <OutputDeliveryLinePrint> conceptos = new List <OutputDeliveryLinePrint>();
            List <OutputDeliveryPrint>     pList     = new List <OutputDeliveryPrint>();

            foreach (OutputDeliveryLineInfo line in item.Conceptos)
            {
                conceptos.Add(OutputDeliveryLinePrint.New(line));
            }

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

            pList.Add(item.GetPrintObject());

            ReportClass doc = null;

            try
            {
                doc = GetReportFromName("Delivery", "WorkDeliveryRpt");
            }
            catch
            {
                doc = new WorkDeliveryRpt();
            }

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

            CompanyInfo empresa = CompanyInfo.Get(Schema.Oid);

            doc.SetParameterValue("nombreEmpresa", empresa.Name);
            doc.SetParameterValue("dirEmpresa", empresa.Direccion);
            doc.SetParameterValue("CIFEmpresa", empresa.VatNumber);
            doc.SetParameterValue("TlfEmpresa", empresa.Telefonos);
            doc.SetParameterValue("WebEmpresa", empresa.Url);
            doc.SetParameterValue("WorkCode", (work != null) ? work.Codigo : string.Empty);
            doc.SetParameterValue("WorkDescription", (work != null) ? work.Description : string.Empty);

            return(doc);
        }
        public OutputInvoice NewItem(OutputDeliveryInfo albaran)
        {
            OutputInvoice item = NewItem();

            ClienteInfo cliente = ClienteInfo.Get(albaran.OidHolder, false, true);

            item.CopyFrom(cliente);
            item.CopyFrom(albaran);
            item.Insert(albaran);

            SetNextCode(item);

            return(item);
        }
        protected void CopyValues(OutputDeliveryInfo delivery, ExpedientInfo expedient)
        {
            if (delivery == null)
            {
                return;
            }

            Oid = delivery.Oid;
            _base.CopyValues(delivery);

            if (expedient != null)
            {
                _base.ExpedientID = expedient.Codigo;
            }
        }
        public static AlbaranTicket NewChild(Ticket ticket, OutputDeliveryInfo albaran)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            AlbaranTicket obj = new AlbaranTicket();

            obj.OidTicket       = ticket.Oid;
            obj.OidAlbaran      = albaran.Oid;
            obj.CodigoTicket    = ticket.Codigo;
            obj.CodigoAlbaran   = albaran.Codigo;
            obj.FechaAsignacion = DateTime.Today;

            return(obj);
        }
Esempio n. 10
0
        public static AlbaranFactura NewChild(OutputInvoice factura, OutputDeliveryInfo albaran)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            AlbaranFactura obj = new AlbaranFactura();

            obj.OidFactura      = factura.Oid;
            obj.OidAlbaran      = albaran.Oid;
            obj.CodigoFactura   = factura.Codigo;
            obj.CodigoAlbaran   = albaran.Codigo;
            obj.FechaAsignacion = DateTime.Today;

            return(obj);
        }
        public ReportClass GetAlbaran(OutputDeliveryInfo item, FormatConfFacturaAlbaranReport conf)
        {
            if (item == null)
            {
                return(null);
            }

            List <OutputDeliveryLinePrint> conceptos = new List <OutputDeliveryLinePrint>();
            List <OutputDeliveryPrint>     pList     = new List <OutputDeliveryPrint>();

            foreach (OutputDeliveryLineInfo cfi in item.Conceptos)
            {
                conceptos.Add(OutputDeliveryLinePrint.New(cfi));
            }

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

            pList.Add(item.GetPrintObject());

            ProductList productos = ProductList.GetList(false);

            foreach (OutputDeliveryLinePrint cfp in conceptos)
            {
                if (cfp.OidProducto == 0)
                {
                    continue;
                }
                ProductInfo prod = productos.GetItem(cfp.OidProducto);
                if (prod != null)
                {
                    if (prod.AyudaKilo > 0)
                    {
                        cfp.Concepto += " *";
                    }
                }
            }

            ReportClass doc = null;

            try
            {
                doc = GetReportFromName("Delivery", "OutputDeliveryRpt");
            }
            catch
            {
                doc = new OutputDeliveryRpt();
            }

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

            doc.SetDataSource(pList);
            CompanyInfo empresa = CompanyInfo.Get(Schema.Oid);

            doc.SetParameterValue("nombreEmpresa", empresa.Name);
            doc.SetParameterValue("dirEmpresa", empresa.Direccion);
            doc.SetParameterValue("CIFEmpresa", empresa.VatNumber);
            doc.SetParameterValue("TlfEmpresa", empresa.Telefonos);
            doc.SetParameterValue("nota", (conf.nota != null) ? conf.nota : string.Empty);

            return(doc);
        }
Esempio n. 12
0
        /// <summary>
        /// Crea los conceptos de factura asociados a un albarán
        /// </summary>
        /// <param name="source"></param>
        public virtual void Compact(OutputInvoice invoice)
        {
            if (this.Count == 0)
            {
                return;
            }

            OutputDelivery main_albaran = null;
            Cash           caja         = null;

            try
            {
                List <long> oid_list = new List <long>();

                foreach (AlbaranFactura item in this)
                {
                    oid_list.Add(item.OidAlbaran);
                }

                OutputDeliveryList albaranes = OutputDeliveryList.GetList(oid_list, true);
                main_albaran = OutputDelivery.Get(oid_list[0], true, invoice.SessionCode);

                foreach (AlbaranFactura af in this)
                {
                    if (af.OidAlbaran == main_albaran.Oid)
                    {
                        continue;
                    }

                    OutputDeliveryInfo source = albaranes.GetItem(af.OidAlbaran);
                    main_albaran.Merge(source);
                }

                main_albaran.Compact();

                SortedBindingList <AlbaranFactura> sorted_list = this.GetSortedList("CodigoAlbaran", ListSortDirection.Ascending);
                OutputDeliveryInfo first_albaran = OutputDeliveryInfo.Get(sorted_list[0].OidAlbaran, ETipoEntidad.Cliente, false);

                main_albaran.CopyFrom(invoice);
                main_albaran.Codigo = first_albaran.Codigo;
                main_albaran.Serial = first_albaran.Serial;
                main_albaran.Save();

                ToDelete = new List <OutputDeliveryInfo>();

                for (int i = 1; i < oid_list.Count; i++)
                {
                    Remove(GetItemByAlbaran(oid_list[i]).Oid);
                    ToDelete.Add(albaranes.GetItem(oid_list[i]));
                }

                CashLine.DeleteByAlbaranList(albaranes.GetListInfo(), ModulePrincipal.GetCajaTicketsSetting());
                Ticket.DeleteFromList(albaranes.GetListInfo());

                //Actualizamos la caja de Tickets
                caja = Cash.Get(ModulePrincipal.GetCajaTicketsSetting(), true, invoice.SessionCode);
                caja.UpdateSaldo();
                caja.SaveAsChild();

                AlbaranFactura ab = GetItemByAlbaran(main_albaran.Oid);
                ab.CodigoAlbaran = main_albaran.Codigo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Cache.Instance.Remove(typeof(ClienteList));
                Cache.Instance.Remove(typeof(ProductList));
            }
        }
Esempio n. 13
0
 public static string SELECT(OutputDeliveryInfo albaran)
 {
     return(SELECT(new QueryConditions {
         OutputDelivery = albaran
     }));
 }
Esempio n. 14
0
 public static string SELECT(OutputDeliveryInfo source)
 {
     return(SELECT(new QueryConditions {
         OutputDelivery = source
     }));
 }
Esempio n. 15
0
 public AlbaranTicket NewItem(Ticket factura, OutputDeliveryInfo albaran)
 {
     this.AddItem(AlbaranTicket.NewChild(factura, albaran));
     factura.SetAlbaranes();
     return(this[Count - 1]);
 }
        /// <summary>
        /// Copia los atributos del objeto
        /// </summary>
        /// <param name="source">Objeto origen</param>
        protected void CopyValues(AlbaranTicketInfo source, ClienteInfo cliente, TicketInfo ticket, OutputDeliveryInfo Albaran)
        {
            if (source == null)
            {
                return;
            }

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

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

            _base.CodigoTicket = ticket.Codigo;
            _total_factura     = ticket.Total;
            _numero_serie      = serie.Identificador;
            _fecha_factura     = ticket.Fecha;
            _prevision         = ticket.Prevision;

            //INNER JOIN
            _codigo_cliente = cliente.Codigo;
            _nombre         = cliente.Nombre;
            _telefonos      = cliente.Telefonos;
            _movil          = cliente.Movil;
            _dias_pago      = Albaran.Fecha.Subtract(ticket.Fecha).Days;
        }
Esempio n. 17
0
 public AlbaranFactura NewItem(OutputInvoice factura, OutputDeliveryInfo albaran)
 {
     this.AddItem(AlbaranFactura.NewChild(factura, albaran));
     factura.SetAlbaranes();
     return(this[Count - 1]);
 }