Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Session.Remove("F");
            Session.Remove("R");
            if (Request["F"] != null)
            {
                Struct_Factura F = Struct_Factura.GetFacturaById(Data2.Statics.Conversion.ObtenerLocal(UserId), int.Parse(Request["F"]));
                if (F != null)
                {
                    Session.Add("F", F);
                }
            }

            if (Request["R"] != null)
            {
                Struct_Remito R = Struct_Remito.Get_Remito(int.Parse(Request["R"]), Data2.Statics.Conversion.ObtenerLocal(UserId));
                if (R != null)
                {
                    Session.Add("R", R);
                }
            }


            try
            {
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemplo n.º 2
0
        private void BuildGraph()
        {
            List <Data2.Class.Struct_Factura> _LF = Session[sessionkey] as List <Data2.Class.Struct_Factura>;
            List <Data2.Class.Struct_Remito>  _LR = Struct_Remito.GetAllRemitos(UserId);

            if (_LF != null && _LF.Count > 0)
            {
                HF_Data.Value = "1";
                int _FA = 0;
                int _FB = 0;
                int _FC = 0;
                int _FX = 0;
                int _FP = 0;
                int _R  = 0;

                if (_LR != null)
                {
                    _R = _LR.Count;
                }

                for (int a = 0; a < _LF.Count; a++)
                {
                    switch (_LF[a].FacturaTipo)
                    {
                    case Struct_Factura.TipoDeFactura.FacturaA:
                        _FA++;
                        break;

                    case Struct_Factura.TipoDeFactura.FacturaB:
                        _FB++;
                        break;

                    case Struct_Factura.TipoDeFactura.FacturaC:
                        _FC++;
                        break;

                    case Struct_Factura.TipoDeFactura.FacturaX:
                        _FX++;
                        break;

                    case Struct_Factura.TipoDeFactura.Presupuesto:
                        _FP++;
                        break;
                    }
                }

                HF_DataCant.Value  = _FA.ToString() + "," + _FB.ToString() + "," + _FC.ToString() + "," + _FX.ToString() + "," + _FP.ToString() + "," + _R.ToString();
                HF_DataTitle.Value = "Comprobantes periodo:" + _LF[0].Fecha.ToShortDateString() + "-" + _LF[_LF.Count - 1].Fecha.ToShortDateString();
            }
            else
            {
                HF_Data.Value = "0";
            }
        }
Exemplo n.º 3
0
        void LlenarFactura(int facturaid, int idRemito = 0)
        {
            Struct_Factura _F = Struct_Factura.GetFacturaById(UserId, facturaid);

            try
            {
                if (idRemito == 1)
                {
                    Struct_Remito R = Struct_Remito.Get_Remito(facturaid, UserId);
                    _F          = new Struct_Factura(R);
                    _F.IsRemito = true;
                    _F.Remito.GetAndFillDetalle();
                }
            }
            catch (Exception E)
            {
                Data2.Statics.Log.ADD(E.StackTrace + "(" + E.Message + ")", this);
            }
            if (_F != null)
            {
                if (_F.IsRemito == false)
                {
                    field_date.InnerText  = _F.Fecha.ToLongDateString();
                    field_domi.InnerText  = _F.domicilio;
                    field_iva.InnerText   = _F.Condicion_IVA.ToString();
                    field_name.InnerText  = _F.senores;
                    field_pay.InnerText   = _F.Pago.ToString();
                    field_phone.InnerText = _F.telefono;

                    List <Struct_DetalleFactura> List_detalle = _F.GetDetalle();
                    if (List_detalle != null && List_detalle.Count > 0)
                    {
                        int  renglones = 1;
                        bool alternate = false;
                        foreach (Struct_DetalleFactura D in List_detalle)
                        {
                            string _cantidad;
                            string _preciou;
                            string _total;

                            if (D.isdec)
                            {
                                _cantidad = D.DETALLEDEC.ToString("#.00");
                            }
                            else
                            {
                                _cantidad = D.DETALLEINT.ToString();
                            }
                            if (_F.FacturaTipo == Struct_Factura.TipoDeFactura.FacturaA)
                            {
                                _preciou = D.getPrecioFinalSinIva().ToString("#.00");
                            }
                            else
                            {
                                _preciou = D.PRODUCTO.PrecioFinal.ToString("#.00");
                            }
                            if (_F.FacturaTipo == Struct_Factura.TipoDeFactura.FacturaA)
                            {
                                _total = D.getTotalSinIva().ToString("#.00");
                            }
                            else
                            {
                                _total = D.getTotalConIva().ToString("#.00");
                            }

                            HtmlGenericControl _HTMLCONTROL = GenerarFilaDetalle(_cantidad, D.PRODUCTO.Descripcion, _preciou, _total, alternate);
                            Table_detail.Controls.AddAt(renglones, _HTMLCONTROL);
                            if (alternate)
                            {
                                alternate = false;
                            }
                            else
                            {
                                alternate = true;
                            }

                            renglones++;//Para que los meta en orden correspondiente
                        }
                    }
                    if (_F.FacturaTipo == Struct_Factura.TipoDeFactura.FacturaA)
                    {
                        Table_detail.Controls.Add(GenerarFilaPieFactura("Sub Total:", _F.subtotal.ToString("#.00")));

                        foreach (decimal DEC in _F.GetIvasInscriptos())
                        {
                            decimal _CurrentIva = _F.GetTotalDeInsceripcionIva(DEC);
                            Table_detail.Controls.Add(GenerarFilaPieFactura("IVA Insc: " + DEC.ToString("#.00") + "%", _CurrentIva.ToString("#.00")));
                        }
                    }

                    Table_detail.Controls.Add(GenerarFilaPieFactura("Total:", _F.total.ToString("#.00")));
                }
                else
                {
                    try
                    {
                        field_date.InnerText  = _F.Remito.Fecha.ToLongDateString();
                        field_domi.InnerText  = _F.Remito.get_SUPPLIER().Localidad;
                        field_iva.InnerText   = "";
                        field_name.InnerText  = _F.Remito.get_SUPPLIER().NombreFantasia;
                        field_pay.InnerText   = "";
                        field_phone.InnerText = _F.Remito.get_SUPPLIER().Telefono1;



                        List <Struct_DetalleRemito> List_detalle = _F.Remito.GetAndFillDetalle();

                        if (List_detalle != null && List_detalle.Count > 0)
                        {
                            int  renglones = 1;
                            bool alternate = false;
                            foreach (Struct_DetalleRemito D in List_detalle)
                            {
                                string _cantidad;
                                string _preciou;
                                string _total;

                                if (D.IsDecimal)
                                {
                                    _cantidad = D.CANTDEC.ToString("#.00");
                                }
                                else
                                {
                                    _cantidad = D.CANTINT.ToString();
                                }
                                _preciou = D.Costo.ToString("#.00");
                                _total   = D.Total.ToString("#.00");

                                HtmlGenericControl _HTMLCONTROL = GenerarFilaDetalle(_cantidad, D.P.Descripcion, D.Costo.ToString("#.00"), D.Total.ToString("#.00"), alternate);
                                Table_detail.Controls.AddAt(renglones, _HTMLCONTROL);
                                if (alternate)
                                {
                                    alternate = false;
                                }
                                else
                                {
                                    alternate = true;
                                }

                                renglones++;//Para que los meta en orden correspondiente
                            }
                        }


                        Table_detail.Controls.Add(GenerarFilaPieFactura("Total:", _F.Remito.total.ToString("#0.00")));
                    }
                    catch (Exception E)
                    {
                        Data2.Statics.Log.ADD(E.StackTrace + "(" + E.Message + ")", this);
                    }
                }
            }
        }