示例#1
0
        public static void LoadDataInvoiceReport(string _idv_invoice, string _tienda_id)
        {
            DataSet dsInvoiceHdr = Dat_Venta.leer_VTEX_venta_guia(_idv_invoice, _tienda_id);

            if (dsInvoiceHdr != null && dsInvoiceHdr.Tables[0].Rows.Count > 0)
            {
                ds_paquete = new DataSet();
                ds_paquete.Tables.Add(dsInvoiceHdr.Tables[2].Copy());

                DataTable dsInvHdr     = dsInvoiceHdr.Tables[0];
                String    destinatario = dsInvHdr.Rows[0]["nombres"].ToString();
                ///
                String idPerson = dsInvHdr.Rows[0]["Ven_Id"].ToString();
                ///
                String ubicacionCustomer = dsInvHdr.Rows[0]["direccion"].ToString();
                ///
                String telefono = dsInvHdr.Rows[0]["Bas_Telefono"].ToString();
                ///
                String celular = dsInvHdr.Rows[0]["Bas_Celular"].ToString();
                ///
                String transportadora = dsInvHdr.Rows[0]["Tra_Descripcion"].ToString();
                ///
                String guia = dsInvHdr.Rows[0]["Tra_Gui_No"].ToString();

                String lider     = dsInvHdr.Rows[0]["lider"].ToString();
                String lider_dir = dsInvHdr.Rows[0]["direccion_lider"].ToString();

                string agencia = dsInvHdr.Rows[0]["agencia"].ToString();

                string agencia_ruc = dsInvHdr.Rows[0]["agencia_ruc"].ToString();
                ///
                Decimal iva = 0;   //Convert.ToDecimal(dsInvHdr.Rows[0]["ihn_taxes"].ToString());
                ///
                Decimal flete = 0; //Convert.ToDecimal(dsInvHdr.Rows[0]["ihn_handling"].ToString());
                /// Fecha de remision
                ///
                DateTime fechaRemision = Convert.ToDateTime(dsInvHdr.Rows[0]["Ven_Fecha"].ToString());
                ///
                String esCopia = "";// ((Convert.ToDecimal(dsInvHdr.Rows[0]["IHN_PRT_CNT"].ToString())) > 1) ? " *** COPIA *** " : "";

                /// Descuento general
                Decimal dsctoGnral = 0;//Convert.ToDecimal(dsInvHdr.Rows[0]["ion_disscount"].ToString());

                ///
                String typeresolution = "";//dsInvHdr.Rows[0]["nuv_typeresolution"].ToString();

                ///

                string direccionf = "";
                string ubicalugar = dsInvHdr.Rows[0]["ubicalugar"].ToString();


                String resolucion = ""; //"Facturación " + typeresolution + " por Res. Dian " + dsInvHdr.Rows[0]["nuv_resolution"].ToString() +
                                        //" De " + (String.Format("{0:MM/dd/yyyy}", Convert.ToDateTime(dsInvHdr.Rows[0]["nud_date"].ToString()))) +
                                        // " Del Pref " + dsInvHdr.Rows[0]["NUV_CODE"].ToString() + "-" + dsInvHdr.Rows[0]["NUN_INVOICE_START"].ToString()
                                        //  + " Al Pref " + dsInvHdr.Rows[0]["NUV_CODE"].ToString() + "-" + dsInvHdr.Rows[0]["nun_invoice_end"].ToString();
                ///

                String puntoLlegada = "";         // dsInvHdr.Rows[0]["OHV_SHIP_TO"].ToString();

                String msgs = "";                 //dsInvHdr.Rows[0]["imv_text"].ToString();
                ///
                DataSet dsInvDtl = new DataSet(); // null;// _invDtlVM.getInvoiceDtl(_co, _idv_invoice);
                dsInvDtl.Tables.Add(dsInvoiceHdr.Tables[1].Copy());

                String wavDescription = "";
                String wavAddress     = "";
                String wavPhone       = "";

                foreach (DataRow drLine in dsInvDtl.Tables[0].Rows)
                {
                    ///
                    String numeroFactura = drLine["Ven_Det_Id"].ToString();
                    ///
                    String respCopia = esCopia;
                    ///
                    /// Detalle de la factura
                    ///
                    String codigoArticulo = drLine["Ven_Det_ArtId"].ToString();
                    ///
                    String nomArticulo = drLine["Art_Descripcion"].ToString();
                    ///
                    String marca = drLine["Mar_Descripcion"].ToString();
                    ///
                    Decimal cantidad = Convert.ToDecimal(drLine["Ven_Det_Cantidad"].ToString());
                    ///
                    String talla = drLine["Ven_Det_TalId"].ToString();;
                    ///
                    Decimal valorVentaArticulo = 0; // Convert.ToDecimal(drLine["idn_sellprice"].ToString());
                    ///
                    Decimal valorLinea = 0;         // Convert.ToDecimal(drLine["articlevalue"].ToString());
                    ///
                    Decimal dsctoArticulo = 0;      // Convert.ToDecimal((drLine["idn_disscount"].ToString().Equals(String.Empty)) ? "0" : (drLine["idn_disscount"].ToString()));
                    ///
                    Decimal comisionArticulo = 0;   // Convert.ToDecimal(drLine["idn_commission"].ToString());
                    ///
                    String color = drLine["Col_Descripcion"].ToString();

                    String wavUbication = drLine["Des_Seguimiento"].ToString(); //campo descripcion seguimiento

                    ReportInvoiceClass objRI = new ReportInvoiceClass(destinatario, ubicacionCustomer, telefono, celular, "", idPerson, "",
                                                                      _idv_liquidation, numeroFactura, fechaRemision, resolucion, "",
                                                                      respCopia, typeresolution, codigoArticulo, nomArticulo, color,
                                                                      cantidad, talla, valorVentaArticulo,
                                                                      dsctoArticulo, comisionArticulo, marca, valorLinea, iva, flete, guia, transportadora, msgs, dsctoGnral,
                                                                      wavDescription, wavAddress, wavPhone, wavUbication, puntoLlegada, ubicalugar, direccionf, lider, lider_dir, agencia, agencia_ruc);

                    _invoiceData.Add(objRI);
                }/// End foreach
            }
        }