Exemple #1
0
        private void FgDetalle_RowColChange(object sender, EventArgs e)
        {
            if (booAgregando == true)
            {
                return;
            }

            DataTable dtUniMed      = new DataTable();
            int       intProductoId = 0;

            if (FgDetalle.Col == 2)
            {
                intProductoId = Convert.ToInt32(FgDetalle.GetData(FgDetalle.Row, 6));                         // OBTENEMOS EL ID DEL ITEM SELECCIONADO
                dtUniMed      = funGen.DataTableFiltrar(dtUnidadMedida, "n_idite = " + intProductoId + "");
                funFlex.FlexColumnaCombo(FgDetalle, dtUniMed, "c_abrpre", 2);
            }
        }
Exemple #2
0
        bool Grabar()
        {
            bool booOk   = false;
            int  intFila = 0;

            BE_VTA_VENTAS    entDocumento    = new BE_VTA_VENTAS();
            BE_VTA_VENTASDET entDocumentoDet = new BE_VTA_VENTASDET();

            entDocumento.n_idven    = 1;
            entDocumento.n_idemp    = STU_SISTEMA.EMPRESAID;
            entDocumento.n_anotra   = STU_SISTEMA.ANOTRABAJO;
            entDocumento.n_idmes    = STU_SISTEMA.MESTRABAJO;
            entDocumento.n_idlib    = 2;
            entDocumento.c_numreg   = "0001";
            entDocumento.n_idtippro = 3;
            entDocumento.n_idcli    = 1;
            //if (funFunciones.NulosC(LblIdCliente.Text) != "")
            //{
            //    entDocumento.n_idcli =Convert.ToInt32(LblIdCliente.Text);
            //}
            entDocumento.n_idpunvencli = 0;
            entDocumento.n_idtipdoc    = Convert.ToInt32(CboTipDocumento.SelectedValue);
            entDocumento.c_numser      = LblSerDoc.Text;

            //OBTENEMOS EL NUEVO NUMERO DE DOCUMENTO ANTES DE GUARDAR LA OPERACION
            objNumeroDoc.mysConec = mysConec;
            entDocumento.c_numdoc = objNumeroDoc.HallaNumeroDocumento(entDocumento.n_idemp, entDocumento.n_idtipdoc, entDocumento.c_numser, Constantes.SYS_DOCNUM.GRABAR_NUMERO_GENERADO);

            entDocumento.c_numdoc      = LblNumDoc.Text;
            entDocumento.f_fchreg      = DateTime.Now;
            entDocumento.f_fchdoc      = DateTime.Now;
            entDocumento.f_fchven      = DateTime.Now;
            entDocumento.n_idconpag    = 1;                                  // CONDICION DE PAGO (1 = CONTADO)
            entDocumento.n_idmon       = Convert.ToInt32(CboMoneda.SelectedValue);
            entDocumento.n_impbru      = Convert.ToDouble(LblImpBru.Text);
            entDocumento.n_impbru2     = 0;
            entDocumento.n_impbru3     = 0;
            entDocumento.n_impinaf     = 0;
            entDocumento.n_impigv      = Convert.ToDouble(LblIgv.Text);
            entDocumento.n_impisc      = 0;
            entDocumento.n_impotr      = 0;
            entDocumento.n_imptotven   = Convert.ToDouble(LblTotal.Text);
            entDocumento.n_tc          = Convert.ToDouble(LblTipCam.Text);
            entDocumento.n_impsal      = Convert.ToDouble(LblTotal.Text);
            entDocumento.n_idven       = 0;
            entDocumento.n_tasaigv     = douIGVTasa;
            entDocumento.c_glosa       = "PUNTO DE VENTA";
            entDocumento.n_oriitem     = 1;                                   // (1 = directo; 2 = Guia de Remision;  3 = Cotizacion)
            entDocumento.n_estado      = 1;                                   // (0 = anulado ; 1 = activo)
            entDocumento.n_idtipven    = 1;                                   // TODO LO QUE SE VENDA AQUI SERA VENTA GRAVADA
            entDocumento.n_idtipdocref = 0;
            entDocumento.n_iddocref    = 0;
            entDocumento.n_idtipdes    = 1;                                   // SE APLICA EL TIPO DE DESCUENTO PORCENTAJE
            entDocumento.n_impdes      = 0;                                   // IMPORTE DEL DESCUENTO OBTENIDO
            entDocumento.c_nomcli      = TxtNomCli.Text;
            entDocumento.c_dircli      = TxtDireccion.Text;

            STUVENTAS.entDocumento = entDocumento;

            //List <BE_VTA_VENTASDET> objListaDetalle =  BE_VTA_VENTASDET();
            //List<Author> AuthorList = new List<Author>();
            List <BE_VTA_VENTASDET> objListaDetalle = new List <BE_VTA_VENTASDET>();

            for (intFila = 1; intFila <= FgDetalle.Rows.Count - 1; intFila++)
            {
                BE_VTA_VENTASDET objDetalle = new BE_VTA_VENTASDET();
                //string strCadena = FgDetalle.GetData(intFila, 1).ToString();

                if (FgDetalle.GetData(intFila, 1) != null)
                {
                    objDetalle.n_iditem    = Convert.ToInt32(FgDetalle.GetData(intFila, 6));
                    objDetalle.c_desusu    = FgDetalle.GetData(intFila, 1).ToString();
                    objDetalle.n_idunimed  = Convert.ToInt32(FgDetalle.GetData(intFila, 7));
                    objDetalle.n_canpro    = Convert.ToDouble(FgDetalle.GetData(intFila, 3));
                    objDetalle.n_preunibru = Convert.ToDouble(FgDetalle.GetData(intFila, 8));
                    objDetalle.n_impdes    = 0; //Convert.ToDouble(FgDetalle.GetData(intFila, 3));
                    objDetalle.n_preuninet = Convert.ToDouble(FgDetalle.GetData(intFila, 8));
                    objDetalle.n_imptot    = Convert.ToDouble(FgDetalle.GetData(intFila, 9));

                    objListaDetalle.Add(objDetalle);
                }
            }

            STUVENTAS.entDocumentodetalle = objListaDetalle;

            objVentas.mysConec = mysConec;
            if (objVentas.Insertar(STUVENTAS) == true)
            {
                booOk = true;
            }


            return(booOk);
        }
Exemple #3
0
        void AsignarEntidad()
        {
            l_DocumentoDet.Clear();
            l_DetDoc.Clear();
            l_DetOCT.Clear();

            e_Documento.n_id          = 0;
            e_Documento.n_idemp       = STU_SISTEMA.EMPRESAID;
            e_Documento.n_anotra      = STU_SISTEMA.ANOTRABAJO;
            e_Documento.n_idmes       = STU_SISTEMA.MESTRABAJO;
            e_Documento.n_idlib       = 14;
            e_Documento.c_numreg      = "";
            e_Documento.n_idtippro    = 2;
            e_Documento.n_idcli       = Convert.ToInt32(LblIdCliente.Text);
            e_Documento.n_idpunvencli = 0;
            e_Documento.n_idtipdoc    = Convert.ToInt32(CboTipDocumento.SelectedValue);
            e_Documento.c_numser      = LblSerDoc.Text;
            e_Documento.c_numdoc      = LblNumDoc.Text;
            if (e_Documento.n_idmes == 0)
            {
                e_Documento.d_fchreg = Convert.ToDateTime("01/01/" + e_Documento.n_anotra.ToString("0000"));
            }
            else
            {
                e_Documento.d_fchreg = Convert.ToDateTime("01/" + LblFchEmi.Text.Substring(3, 2) + "/" + LblFchEmi.Text.Substring(6, 4));
            }
            e_Documento.d_fchdoc    = Convert.ToDateTime(LblFchEmi.Text);
            e_Documento.d_fchven    = Convert.ToDateTime(LblFchEmi.Text);
            e_Documento.n_idconpag  = 1;
            e_Documento.n_idmon     = Convert.ToInt32(CboMoneda.SelectedValue);
            e_Documento.n_impbru    = Convert.ToDouble(LblImpBru.Text);
            e_Documento.n_impbru2   = 0;
            e_Documento.n_impbru3   = 0;
            e_Documento.n_impinaf   = 0;
            e_Documento.n_impigv    = Convert.ToDouble(LblIgv.Text);
            e_Documento.n_impisc    = 0;
            e_Documento.n_impotr    = 0;
            e_Documento.n_imptotven = Convert.ToDouble(LblTotal.Text);
            e_Documento.n_tc        = Convert.ToDouble(LblTipCam.Text);
            e_Documento.n_impsal    = Convert.ToDouble(LblTotal.Text);
            e_Documento.n_idven     = 0;
            e_Documento.n_tasaigv   = douIGVTasa;
            e_Documento.c_glosa     = "VENTA EN MOSTRADOR DEL DIA " + LblFchEmi.Text;
            e_Documento.n_impsubtot = Convert.ToDouble(LblImpBru.Text);
            e_Documento.n_pordsc    = 0;
            e_Documento.n_idtipope  = 1;

            e_Documento.n_idtipdocref = 0;
            e_Documento.n_iddocref    = 0;

            e_Documento.c_serdocref = "";
            e_Documento.c_numdocref = "";

            string c_mon = "";

            if (Convert.ToDouble(CboMoneda.SelectedValue) == 115)
            {
                c_mon = "soles.";
            }
            if (Convert.ToDouble(CboMoneda.SelectedValue) == 151)
            {
                c_mon = "dolares americanos.";
            }
            e_Documento.c_numlet = funLet.Convertir(LblTotal.Text, true, c_mon);

            e_Documento.n_oriitem = 1;             // INDICAMOS QUE LA VENTA NO TIENE GUIA DE REMISION
            e_Documento.n_anulado = 0;
            e_Documento.c_motnc   = "";

            if (OptForPag1.Checked == true)
            {
                e_Documento.n_idforpag = 1;
            }
            if (OptForPag2.Checked == true)
            {
                e_Documento.n_idforpag = 2;
            }

            if (OptTarCre1.Checked == true)
            {
                e_Documento.n_idtarcre = 1;
            }
            if (OptTarCre1.Checked == true)
            {
                e_Documento.n_idtarcre = 2;
            }
            if (OptTarCre1.Checked == true)
            {
                e_Documento.n_idtarcre = 3;
            }

            int       n_fila      = 0;
            DataTable DtFiltro    = new DataTable();
            string    c_nomitem   = "";
            string    c_presendes = "";
            double    n_valor     = 0;

            if (FgDetalle.Rows.Count > 2)
            {
                for (n_fila = 1; n_fila <= FgDetalle.Rows.Count - 1; n_fila++)
                {
                    if (funFunciones.NulosC(FgDetalle.GetData(n_fila, 1)) != "")
                    {
                        BE_VTA_VENTASDET BE_Detalle = new BE_VTA_VENTASDET();

                        c_nomitem   = FgDetalle.GetData(n_fila, 1).ToString();
                        c_presendes = FgDetalle.GetData(n_fila, 2).ToString();

                        BE_Detalle.n_idvta  = e_Documento.n_id;
                        BE_Detalle.n_canpro = Convert.ToDouble(FgDetalle.GetData(n_fila, 3).ToString());

                        BE_Detalle.n_iditem   = Convert.ToInt32(FgDetalle.GetData(n_fila, 6).ToString());
                        BE_Detalle.n_idunimed = Convert.ToInt32(FgDetalle.GetData(n_fila, 7).ToString());

                        //n_valor = Convert.ToDouble(FgDetalle.GetData(n_fila, 4).ToString());
                        //n_valor = n_valor / ((douIGVTasa / 100) + 1);
                        BE_Detalle.n_preunibru = Convert.ToDouble(FgDetalle.GetData(n_fila, 8).ToString());
                        BE_Detalle.n_preuninet = Convert.ToDouble(FgDetalle.GetData(n_fila, 8).ToString());
                        BE_Detalle.n_imptot    = Convert.ToDouble(FgDetalle.GetData(n_fila, 9).ToString());
                        BE_Detalle.n_idtipven  = 0;
                        BE_Detalle.n_pordsc    = 0;
                        BE_Detalle.n_porigv    = douIGVTasa;
                        //string c_dato = FgDetalle.GetData(n_fila, 8).ToString();
                        //c_dato = funDatos.DataTableBuscar(dtAnex07, "c_codsun", "n_id", c_dato, "C").ToString();
                        BE_Detalle.n_preuninetigv = Convert.ToDouble(FgDetalle.GetData(n_fila, 4).ToString());
                        BE_Detalle.n_imptotigv    = Convert.ToDouble(FgDetalle.GetData(n_fila, 5).ToString());
                        BE_Detalle.n_idtipafeigv  = 1;
                        BE_Detalle.c_datadi       = funFunciones.NulosC(FgDetalle.GetData(n_fila, 9)).ToString();
                        l_DocumentoDet.Add(BE_Detalle);
                    }
                }
            }

            l_DetOCT.Clear();
            BE_VTA_VENTASOCT entOC = new BE_VTA_VENTASOCT();

            ////  1001 - Total valor de venta - operaciones gravadas
            entOC.n_idvta   = 0;
            entOC.n_idcon   = 1;
            entOC.n_importe = Convert.ToDouble(LblImpBru.Text);
            l_DetOCT.Add(entOC);
        }
Exemple #4
0
        private void FgDetalle_CellButtonClick(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
        {
            //if (n_QueHace == 3)
            //{
            //    FgDetalle.AllowEditing = false; return;
            //}
            //if (booAgregando == true) { return; }


            if (FgDetalle.Col == 1)
            {
                int       n_idtipexi = 0;
                DataTable dtResul    = new DataTable();
                string    c_dato     = "";

                booAgregando = true;
                dtResul      = dtItems;
                //if (Convert.ToInt32(CboTipExi.SelectedValue) != 0)
                //{
                //    n_idtipexi = Convert.ToInt32(CboTipExi.SelectedValue);
                //    dtResul = funGen.DataTableFiltrar(dtItems, "n_idtipexi = " + n_idtipexi + "");
                //}

                dtResul = objAlmacen.BuscarItemPuntoVenta("", "n_id", dtResul, n_idtipexi);
                if (dtResul != null)
                {
                    if (dtResul.Rows.Count != 0)
                    {
                        c_dato = dtResul.Rows[0]["n_id"].ToString();        // MOSTRAMOS LA DESCRIPCION DEL ITEM
                        FgDetalle.SetData(e.Row, 6, c_dato);

                        int n_idctacon = Convert.ToInt32(funGen.DataTableBuscar(dtCtaConVen, "n_idite", "n_idpcven", c_dato, "N"));
                        if (n_idctacon == 0)
                        {
                            funFunciones.MensajeMostrarAviso("El item seleccionado no tiene cuenta contable asignada", strTituloFormulario);
                            return;
                        }

                        booAgregando = true;
                        c_dato       = dtResul.Rows[0]["c_despro"].ToString();  // MOSTRAMOS LA DESCRIPCION DEL ITEM
                        FgDetalle.SetData(e.Row, 1, c_dato);



                        c_dato = dtResul.Rows[0]["n_idunimed"].ToString();        // MOSTRAMOS LA DESCRIPCION DEL ITEM
                        FgDetalle.SetData(e.Row, 7, c_dato);

                        c_dato = dtResul.Rows[0]["c_abrpre"].ToString();        // MOSTRAMOS LA PRESENTACION DEL ITEM
                        FgDetalle.SetData(e.Row, 2, c_dato);

                        c_dato = dtResul.Rows[0]["n_preven"].ToString();        // MOSTRAMOS LA PRESENTACION DEL ITEM
                        FgDetalle.SetData(e.Row, 4, c_dato);

                        booAgregando = false;
                        //// MOSTRAMOS EL TIPO DE VENTA
                        //c_dato = funGen.DataTableBuscar(dtAnex07, "n_id", "c_codsun", "1", "C").ToString();
                        //FgDetalle.SetData(FgDetalle.Row, 8, c_dato);
                    }
                }

                booAgregando = false;
                FgDetalle.Select(e.Row, 3);
            }
        }
Exemple #5
0
        private void FgDetalle_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
        {
            if (booAgregando == true)
            {
                return;
            }
            DataTable dtUniMed      = new DataTable();
            DataTable dtResult      = new DataTable();
            int       intProductoId = 0;
            int       intUniMedId   = 0;

            if (e.Col == 1)             // SI SE HA SELECCIONADO ALGUN ITEM DE LA COLUMNA 1
            {
                string strItemDescripcion = FgDetalle.GetData(e.Row, 1).ToString();
                intProductoId = Convert.ToInt32(funGen.DataTableBuscar(dtItems, "c_despro", "n_id", strItemDescripcion, "C"));    // OBTENEMOS EL ID DEL ITEM SELECCIONADO

                FgDetalle.SetData(e.Row, 6, intProductoId);
                dtUniMed = funGen.DataTableFiltrar(dtUnidadMedida, "n_idite = " + intProductoId + "");                            //  FILTRAMOS POR ID DEL PRODUCTO
                if (dtUniMed.Rows.Count != 0)
                {
                    funFlex.FlexColumnaCombo(FgDetalle, dtUniMed, "c_abrpre", 2);
                }

                dtUniMed = funGen.DataTableFiltrar(dtUniMed, "n_default = 1");                                                    //  FILTRAMOS LA UNIDAD DE MEDIDA POR DEFECTO

                FgDetalle.SetData(e.Row, 2, dtUniMed.Rows[0]["c_abrpre"].ToString());                                             // ESTABLECEMOS LA ABREVIATURA DE LA UNIDAD DE MEDIDA
                FgDetalle.SetData(e.Row, 7, dtUniMed.Rows[0]["n_id"].ToString());                                                 // ESTABLECEMOS EL ID DE LA UNIDAD DE MEDIDA
                FgDetalle.SetData(e.Row, 6, intProductoId.ToString());                                                            // ESTABLECEMOS EL ID DE LA EXISTENCIA

                double doupreuniigv = Convert.ToDouble(dtUniMed.Rows[0]["n_preuniigv"].ToString());
                double doupreuni    = Convert.ToDouble(dtUniMed.Rows[0]["n_preuni"].ToString());
                FgDetalle.SetData(e.Row, 4, doupreuniigv.ToString("0.000000"));                                                     // ESTABLECEMOS EL PRECIO CON IGV DEL ITEM
                FgDetalle.SetData(e.Row, 8, doupreuni.ToString("0.000000"));                                                        // ESTABLECEMOS EL PRECIO SIN IGV DEL ITEM

                CalcularFila(e.Row);
                //FgDetalle.Select(FgDetalle.Row - 1, 3);
            }

            if (e.Col == 2)             // SI SE HA SELECCIONADO ALGUN ITEM DE LA COLUMNA 2
            {
                intProductoId = Convert.ToInt32(FgDetalle.GetData(e.Row, 6));
                string strUnidadMedidaDescripcion = FgDetalle.GetData(e.Row, 2).ToString();

                dtUniMed    = funGen.DataTableFiltrar(dtUnidadMedida, "n_idite = " + intProductoId + ""); //  FILTRAMOS LA UNIDAD DE MEDIDA POR DEFECTO
                intUniMedId = Convert.ToInt32(funGen.DataTableBuscar(dtUniMed, "c_abrpre", "n_id", strUnidadMedidaDescripcion, "C"));
                //intUniMedId = Convert.ToInt32(funDatos.DataTableBuscar(dtUnidadMedida, "c_abrpre", "n_id", intProductoId.ToString(), "N"));
                FgDetalle.SetData(e.Row, 7, intUniMedId);

                dtUniMed = funGen.DataTableFiltrar(dtUniMed, "n_id = " + intUniMedId + " AND n_idite = " + intProductoId + "");   //  FILTRAMOS LA UNIDAD DE MEDIDA POR DEFECTO

                double doupreuniigv = Convert.ToDouble(dtUniMed.Rows[0]["n_preuniigv"].ToString());
                double doupreuni    = Convert.ToDouble(dtUniMed.Rows[0]["n_preuni"].ToString());

                FgDetalle.SetData(e.Row, 2, dtUniMed.Rows[0]["c_abrpre"].ToString());                                               // ESTABLECEMOS LA ABREVIATURA DE LA UNIDAD DE MEDIDA
                FgDetalle.SetData(e.Row, 7, dtUniMed.Rows[0]["n_id"].ToString());                                                   // ESTABLECEMOS EL ID DE LA UNIDAD DE MEDIDA
                FgDetalle.SetData(e.Row, 4, doupreuniigv.ToString("0.000000"));                                                     // ESTABLECEMOS EL PRECIO CON IGV DEL ITEM
                FgDetalle.SetData(e.Row, 8, doupreuni.ToString("0.000000"));                                                        // ESTABLECEMOS EL PRECIO SIN IGV DEL ITEM

                CalcularFila(e.Row);
                FgDetalle.Select(FgDetalle.Row - 1, 3);
                return;
            }

            if ((e.Col == 3) || (e.Col == 4))
            {
                //if (e.Col == 4)
                //{
                double douPreSninIGV   = 0;
                double douTotPreSinIGV = 0;

                if (funFunciones.NulosC(FgDetalle.GetData(FgDetalle.Row, 4)) != "")
                {
                    douPreSninIGV   = (Convert.ToDouble(FgDetalle.GetData(FgDetalle.Row, 4)) / (((douIGVTasa) / 100) + 1));
                    douTotPreSinIGV = (douPreSninIGV * Convert.ToDouble(FgDetalle.GetData(FgDetalle.Row, 3)));
                    FgDetalle.SetData(FgDetalle.Row, 8, douPreSninIGV.ToString("0.000000"));
                    FgDetalle.SetData(FgDetalle.Row, 9, douTotPreSinIGV.ToString("0.000000"));
                    CalcularFila(e.Row);
                }

                if (e.Col == 3)
                {
                    FgDetalle.Select(FgDetalle.Row - 1, 4);
                    return;
                }
                if (e.Col == 4)
                {
                    FgDetalle.Select(e.Row, 1);
                    return;
                }
            }
        }
Exemple #6
0
        bool Grabar()
        {
            bool   booOk               = false;
            int    intFila             = 0;
            int    intClienteId        = 0;
            int    intIdClienteDefault = 1;
            int    intIdTipProd        = 3;
            string strNumeroDocumento  = "";
            int    intIdVendedor       = 0;

            if (Convert.ToInt32(CboTipDocumento.SelectedValue) == 2)
            {
                intClienteId = Convert.ToInt32(LblIdCliente.Text);
            }
            if (Convert.ToInt32(CboTipDocumento.SelectedValue) == 4)
            {
                intClienteId = intIdClienteDefault;
            }
            if (Convert.ToInt32(CboTipDocumento.SelectedValue) == 13)
            {
                intClienteId = intIdClienteDefault;
            }

            //OBTENEMOS EL NUEVO NUMERO DE DOCUMENTO ANTES DE GUARDAR LA OPERACION
            objNumeroDoc.mysConec = mysConec;
            strNumeroDocumento    = objNumeroDoc.HallaNumeroDocumento(STU_SISTEMA.EMPRESAID, Convert.ToInt32(CboTipDocumento.SelectedValue), LblSerDoc.Text, Constantes.SYS_DOCNUM.GRABAR_NUMERO_GENERADO);

            BE_VTA_VENTAS    entDocumento    = new BE_VTA_VENTAS();
            BE_VTA_VENTASDET entDocumentoDet = new BE_VTA_VENTASDET();

            entDocumento.n_id          = 1;
            entDocumento.n_idemp       = STU_SISTEMA.EMPRESAID;
            entDocumento.n_anotra      = STU_SISTEMA.ANOTRABAJO;
            entDocumento.n_idmes       = STU_SISTEMA.MESTRABAJO;
            entDocumento.n_idlib       = 2;
            entDocumento.c_numreg      = "0001";
            entDocumento.n_idtippro    = intIdTipProd;
            entDocumento.n_idcli       = intClienteId;
            entDocumento.n_idpunvencli = 0;                                                // PUNTO DE VENTA NO APLICA PARA ESTA OPERACION, YA QUE ES VENTAS EN MOSTRADOR
            entDocumento.n_idtipdoc    = Convert.ToInt32(CboTipDocumento.SelectedValue);
            entDocumento.c_numser      = LblSerDoc.Text;
            entDocumento.c_numdoc      = strNumeroDocumento;
            entDocumento.c_numdoc      = LblNumDoc.Text;
            entDocumento.d_fchreg      = DateTime.Now;
            entDocumento.d_fchdoc      = DateTime.Now;
            entDocumento.d_fchven      = DateTime.Now;
            entDocumento.n_idconpag    = 1;                                  // CONDICION DE PAGO (1 = CONTADO)
            entDocumento.n_idmon       = Convert.ToInt32(CboMoneda.SelectedValue);

            //double douPrecioTotal = 0;
            //double douPrecioTotalSinIGV = 0;
            //double douValorIGV = 0;

            entDocumento.n_impbru = douPrecioTotalSinIGV;        // IMPORTE AFECTO
            //entDocumento.n_impbru = Convert.ToDouble(LblImpBru.Text);      // IMPORTE AFECTO
            entDocumento.n_impbru2 = 0;                          // IMPORTE INAFECTO
            entDocumento.n_impbru3 = 0;
            entDocumento.n_impinaf = 0;

            //entDocumento.n_impigv = Convert.ToDouble(LblIgv.Text);           // IGV
            entDocumento.n_impigv = douValorIGV;           // IGV
            entDocumento.n_impisc = 0;
            entDocumento.n_impotr = 0;

            entDocumento.n_imptotven = douPrecioTotal;      // VENTA TOTAL
            //entDocumento.n_imptotven = Convert.ToDouble(LblTotal.Text);      // VENTA TOTAL
            entDocumento.n_tc      = Convert.ToDouble(LblTipCam.Text);
            entDocumento.n_impsal  = douPrecioTotal;
            entDocumento.n_idven   = intIdVendedor;                           // ID DEL USUARIO QUE SE LOGUEA PARA OPERAR LA CAJA
            entDocumento.n_tasaigv = douIGVTasa;
            entDocumento.c_glosa   = "PUNTO DE VENTA";
            entDocumento.n_oriitem = 1;                                       // (1 = directo; 2 = Guia de Remision;  3 = Cotizacion)
            //entDocumento.n_estado = 1;                                        // (0 = anulado ; 1 = activo)
            entDocumento.n_idtipven    = 1;                                   // TODO LO QUE SE VENDA AQUI SERA VENTA GRAVADA
            entDocumento.n_idtipdocref = 0;
            entDocumento.n_iddocref    = 0;
            entDocumento.n_idtipdes    = 1;                                   // SE APLICA EL TIPO DE DESCUENTO PORCENTAJE
            entDocumento.n_impdes      = 0;                                   // IMPORTE DEL DESCUENTO OBTENIDO
            entDocumento.c_nomcli      = TxtNomCli.Text;
            entDocumento.c_dircli      = TxtDireccion.Text;

            STUVENTAS.entDocumento = entDocumento;

            List <BE_VTA_VENTASDET> objListaDetalle = new List <BE_VTA_VENTASDET>();

            for (intFila = 1; intFila <= FgDetalle.Rows.Count - 1; intFila++)
            {
                BE_VTA_VENTASDET objDetalle = new BE_VTA_VENTASDET();

                if (FgDetalle.GetData(intFila, 1) != null)
                {
                    objDetalle.n_iditem    = Convert.ToInt32(FgDetalle.GetData(intFila, 6));
                    objDetalle.c_desusu    = FgDetalle.GetData(intFila, 1).ToString();
                    objDetalle.n_idunimed  = Convert.ToInt32(FgDetalle.GetData(intFila, 7));
                    objDetalle.n_canpro    = Convert.ToDouble(FgDetalle.GetData(intFila, 3));
                    objDetalle.n_preunibru = Convert.ToDouble(FgDetalle.GetData(intFila, 8));
                    objDetalle.n_impdes    = 0; //Convert.ToDouble(FgDetalle.GetData(intFila, 3));
                    objDetalle.n_preuninet = Convert.ToDouble(FgDetalle.GetData(intFila, 8));
                    objDetalle.n_imptot    = Convert.ToDouble(FgDetalle.GetData(intFila, 9));

                    objListaDetalle.Add(objDetalle);
                }
            }

            STUVENTAS.entDocumentodetalle = objListaDetalle;

            objVentas.mysConec = mysConec;
            //if (objVentas.Insertar(STUVENTAS) == true)
            //{
            //    booOk = true;
            //}


            return(booOk);
        }