Esempio n. 1
0
        private void btn_eliminar_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                DialogResult rpta = MessageBox.Show("Desea Eliminar este registro ?", "Alerta", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (rpta == DialogResult.Yes)
                {
                    DataTable tb_op = new DataTable();

                    tb_op = NFunciones.TABLASQL("select * from tb_docreferencia where idempresa='" + VariablesGenerales.Empresa + "' and idorigen='" + Convert.ToString(vista_datos.GetFocusedRowCellValue(COL_ID)) + "'");

                    if (tb_op.Rows.Count > 0)
                    {
                        MessageBox.Show("No se Puede Eliminar el Documento esta Referenciado a otro Documento ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    else
                    {
                        string eliminarcabecera = NFunciones.ExecuteSQL("DELETE tb_cobrarpagardoc WHERE IDEMPRESA='" + VariablesGenerales.Empresa + "' AND idcobrarpagardoc='" + Convert.ToString(vista_datos.GetFocusedRowCellValue(COL_ID)) + "'");
                        string detalle          = NFunciones.ExecuteSQL("DELETE tb_dcobrarpagardoc WHERE IDEMPRESA='" + VariablesGenerales.Empresa + "' AND idcobrarpagardoc='" + Convert.ToString(vista_datos.GetFocusedRowCellValue(COL_ID)) + "'");
                        string mov = NFunciones.ExecuteSQL("DELETE tb_movcobrarpagardoc_drakback WHERE IDEMPRESA='" + VariablesGenerales.Empresa + "' AND idcobrarpagardoc='" + Convert.ToString(vista_datos.GetFocusedRowCellValue(COL_ID)) + "' AND IDTRANSACCION='" + Convert.ToString(vista_datos.GetFocusedRowCellValue(COL_ID)) + "'");
                        LlegarGrilla();
                        MessageBox.Show("Se Elimino Correctamente", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch
            {
                MessageBox.Show("Elija un registro ", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
        }
Esempio n. 2
0
        private void btn_eliminar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataTable validar = NFunciones.TABLASQL("select * from tb_dcobrarpagardoc d inner join tb_productos p on p.idproducto=d.idproducto and p.idempresa=d.idempresa where p.idempresa='" + VariablesGenerales.Empresa + "' and p.idgrupopro='" + txt_codigo.Text + "'");

            if (validar.Rows.Count > 0)
            {
                MessageBox.Show("No se Puede Eliminar Ya que esta registrado en productos con movimiento !", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                DialogResult respuesta = MessageBox.Show("Esta Seguro de eliminar el registro ?", "Confimación", MessageBoxButtons.OK, MessageBoxIcon.Question);

                if (respuesta == DialogResult.OK)
                {
                    string delete = NFunciones.ExecuteSQL("delete tb_grupopro where idempresa='" + VariablesGenerales.Empresa + "' and idgrupopro='" + txt_codigo.Text + "'");
                    if (delete.Equals("Ok"))
                    {
                        MessageBox.Show("Registro Eliminado!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LlegarGrilla();
                        limpiartxt();
                    }
                    else
                    {
                        MessageBox.Show("No se puedo realizar la Operacion  !", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }
        }
Esempio n. 3
0
 private void btn_cancelar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (_opcion.Equals("N"))
     {
         limpiartxt();
         txt_id.Text = "";
         LlegarGrilla();
     }
     else
     {
         DataTable tb_cabecera = NFunciones.TABLASQL("select * from tb_cobrarpagardoc where idempresa='" + VariablesGenerales.Empresa + "' and idcobrarpagardoc='" + _id + "'");
         if (tb_cabecera.Rows.Count > 0)
         {
             txt_id.Text                  = tb_cabecera.Rows[0]["idcobrarpagardoc"].ToString();
             cbo_clieprov.EditValue       = tb_cabecera.Rows[0]["idclieprov"].ToString();
             dtp_fechadoc.EditValue       = tb_cabecera.Rows[0]["fecha"].ToString();
             dtp_fechaoperacion.EditValue = tb_cabecera.Rows[0]["fechaoperacion"].ToString();
             cbo_documento.EditValue      = tb_cabecera.Rows[0]["iddocumento"].ToString();
             txt_serie.Text               = tb_cabecera.Rows[0]["serie"].ToString();
             txt_numero.Text              = tb_cabecera.Rows[0]["numero"].ToString();
             txt_operacion.Text           = tb_cabecera.Rows[0]["tipo"].ToString();
             cbo_moneda.EditValue         = tb_cabecera.Rows[0]["idmoneda"].ToString();
             txt_tc.Text                  = tb_cabecera.Rows[0]["TC"].ToString();
             LlegarGrilla();
         }
     }
     botones(true);
     LlegarGrilla();
     activartxt(false);
     _opcion = "";
 }
        private void btn_eliminar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                DialogResult rpta = MessageBox.Show("Desea Eliminar este registro ?", "Alerta", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (rpta == DialogResult.Yes)
                {
                    DataTable tbdua    = NFunciones.TABLASQL("SELECT * FROM TB_DUA WHERE IDDUA='" + Convert.ToString(vista_datos.GetFocusedRowCellValue(COL_ID)) + "' AND IDEMPRESA='" + VariablesGenerales.Empresa + "'");
                    string    cabecera = NFunciones.ExecuteSQL("delete tb_dua where iddua='" + Convert.ToString(vista_datos.GetFocusedRowCellValue(COL_ID)) + "'and idempresa='" + VariablesGenerales.Empresa + "'");

                    string referencia = NFunciones.ExecuteSQL("delete tb_docreferencia where idempresa='" + VariablesGenerales.Empresa + "' and iddestino='" + Convert.ToString(vista_datos.GetFocusedRowCellValue(COL_ID)) + "'");
                    // insertar exportacion
                    string exportacion = NFunciones.ExecuteSQL("update tb_dcobrarpagardoc set idref='NULL' where idcobrarpagardoc='" + tbdua.Rows[0]["idcobrarpagardoc"].ToString() + "'");
                    //insertar insumos
                    string deleteinsumos = NFunciones.ExecuteSQL("delete tb_movcobrarpagardoc_drakback where idtransaccion='" + Convert.ToString(vista_datos.GetFocusedRowCellValue(COL_ID)) + "' and idempresa='" + VariablesGenerales.Empresa + "'");
                    VariablesGenerales.refduas = "S";
                    MessageBox.Show("Dua eliminada", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show("Elija un registro ", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
        }
Esempio n. 5
0
        private void btn_editar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //DataTable tb_table = new DataTable();
            //tb_table = NFunciones.TABLASQL("select * from tb_docreferencia where idempresa='" + VariablesGenerales.Empresa + "' and idorigen='" + txt_id.Text + "'");
            //if (tb_table.Rows.Count > 0)
            //{
            //    botones(true);
            //    activartxt(false);
            //    _opcion = "";
            //    MessageBox.Show("Este Registro Esta relacionado con otros Registro, No se puede realizar la operación !");
            //    return;
            //}
            //else
            //{
            //    botones(false);
            //    activartxt(true);
            //    _opcion = "E";
            //}


            if (_idoperacion.Equals("C"))
            {
                DataTable tb_table = new DataTable();
                tb_table = NFunciones.TABLASQL("select * from tb_movcobrarpagardoc_drakback where idcobrarpagardoc='" + txt_id.Text + "' AND NOT idtransaccion='" + txt_id.Text + "' AND idempresa='" + VariablesGenerales.Empresa + "'");
                if (tb_table.Rows.Count > 0)
                {
                    botones(true);
                    activartxt(false);
                    _opcion = "";
                    MessageBox.Show("Este Registro Esta relacionado con otros Registro, No se puede realizar la operación !");
                    return;
                }
                else
                {
                    botones(false);
                    activartxt(true);
                    _opcion = "E";
                }
            }
            if (_idoperacion.Equals("V"))
            {
                DataTable tb_table = new DataTable();
                tb_table = NFunciones.TABLASQL("select * from tb_docreferencia where idempresa='" + VariablesGenerales.Empresa + "' and idorigen='" + txt_id.Text + "'");
                if (tb_table.Rows.Count > 0)
                {
                    botones(true);
                    activartxt(false);
                    _opcion = "";
                    MessageBox.Show("Este Registro Esta relacionado con otros Registro, No se puede realizar la operación !");
                    return;
                }
                else
                {
                    botones(false);
                    activartxt(true);
                    _opcion = "E";
                }
            }
        }
Esempio n. 6
0
 private void Frm_Ventas_Load(object sender, EventArgs e)
 {
     if (tipo.Equals("N"))
     {
         DataTable tb_empresa = NFunciones.TABLASQL("SELECT * FROM TB_EMPRESA WHERE IDEMPRESA='" + VariablesGenerales.Empresa + "'");
         txt_tc.Text                  = tb_empresa.Rows[0]["TC"].ToString();
         txt_regimen.Text             = tb_empresa.Rows[0]["regimen"].ToString();
         txt_aduanas.Text             = tb_empresa.Rows[0]["codigo_aduanas"].ToString();
         txt_porc_drawback.Text       = tb_empresa.Rows[0]["porc_drawback"].ToString();
         dtp_fechaoperacion.EditValue = DateTime.Now.ToShortDateString();
         llenarExportacion();
         crearid();
         botones(true);
     }
     if (tipo.Equals("E"))
     {
     }
     if (tipo.Equals("V"))
     {
         try
         {
             txt_tc.Enabled             = false;
             txt_dua.Enabled            = false;
             dtp_fechaoperacion.Enabled = false;
             DataTable tb_cabecera = NFunciones.TABLASQL("SELECT * FROM tb_dua WHERE idempresa='" + VariablesGenerales.Empresa + "' AND iddua='" + id + "'");
             if (tb_cabecera.Rows.Count > 0)
             {
                 botones(false);
                 txt_tc.Text                  = tb_cabecera.Rows[0]["TC"].ToString();
                 txt_regimen.Text             = tb_cabecera.Rows[0]["regimen"].ToString();
                 txt_aduanas.Text             = tb_cabecera.Rows[0]["codigo_aduanas"].ToString();
                 txt_porc_drawback.Text       = tb_cabecera.Rows[0]["porc_drawback"].ToString();
                 dtp_fechaoperacion.EditValue = tb_cabecera.Rows[0]["fecha"].ToString();
                 txt_dua.Text                 = tb_cabecera.Rows[0]["ndua"].ToString();
                 txt_ncajas.Text              = tb_cabecera.Rows[0]["ncajas"].ToString();
                 txt_importetotal.Text        = tb_cabecera.Rows[0]["importetotal"].ToString();
                 string idrefexportacion = tb_cabecera.Rows[0]["idcobrarpagardoc"].ToString();
                 // agregar detalleexpoertacion
                 dtg_exportaciones.DataSource = NFunciones.TABLASQL("SELECT c.idcobrarpagardoc ID,d.idproducto IDPRODUCTO,d.descripcion PRODUCTO,d.cantidad CANTIDAD,d.idunidad UNIDAD FROM tb_cobrarpagardoc c inner join tb_dcobrarpagardoc d on c.idcobrarpagardoc=d.idcobrarpagardoc and c.idempresa=d.idempresa WHERE c.idempresa='" + VariablesGenerales.Empresa + "' AND c.idcobrarpagardoc='" + idrefexportacion + "'");
                 //agregar detalle insumos
                 Program.detalleinsumos = NFunciones.TABLASQL("select m.idcobrarpagardoc ID,C.iddocumento+' '+C.serie+' - '+C.numero DOCUMENTO,C.idclieprov IDPROVEEDOR,C.razonsocial PROVEEDOR, m.idproducto IDPRODUCTO,m.descripcion PRODUCTO,m.idunidad UNIDAD,m.CANTIDAD from tb_movcobrarpagardoc_drakback m  INNER JOIN tb_cobrarpagardoc c on c.idcobrarpagardoc=m.idcobrarpagardoc and c.idempresa=m.idempresa where M.idtransaccion='" + id + "' and M.idempresa='" + VariablesGenerales.Empresa + "'");
                 dtg_insumos.DataSource = Program.detalleinsumos;
             }
             else
             {
                 MessageBox.Show("Ocurrio un problema , no se pudio cargar la información!", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 this.Close();
             }
         }
         catch
         {
             MessageBox.Show("Ocurrio un problema , no se pudio cargar la información!", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             this.Close();
         }
     }
 }
        private void btn_guardar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (txt_codigo.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Codigo de Empresa !");
                return;
            }
            if (txt_razonsocial.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Razon Social !");
                return;
            }
            //if (txt_ruc.Text.Equals(""))
            //{
            //    MessageBox.Show("Debe Ingresar Ruc!");
            //    return;
            //}
            if (cbo_tipo.Text.Equals("[Seleccionar]"))
            {
                MessageBox.Show("Debe Ingresar Tipo Empresa !");
                return;
            }


            if (_modo.Equals("N"))
            {
                DataTable tb_table = new DataTable();
                tb_table = NFunciones.TABLASQL("select idclieprov from tb_clieprov where idclieprov='" + txt_codigo.Text + "' and idempresa='" + VariablesGenerales.Empresa + "'");
                if (tb_table.Rows.Count > 0)
                {
                    MessageBox.Show("Ya existe el codigo ingresado debe colocar uno que nuevo !");
                    return;
                }


                string rpta = NFunciones.ExecuteSQL("insert into tb_clieprov(idempresa,idclieprov,razonsocial,ruc,tipoclieprov,estado) values('" + VariablesGenerales.Empresa + "','" + txt_codigo.Text.ToUpper() + "','" + txt_razonsocial.Text.ToUpper() + "','" + txt_ruc.Text.ToUpper() + "','" + cbo_tipo.EditValue.ToString() + "','1')");
                if (rpta.Equals("Ok"))
                {
                    LlegarGrilla();
                    botones(true);
                    activartxt(false);
                    MessageBox.Show("Guardado Correctamente");
                }
            }
            if (_modo.Equals("E"))
            {
                string rpta = NFunciones.ExecuteSQL("update tb_clieprov set razonsocial='" + txt_razonsocial.Text.ToUpper() + "',ruc='" + txt_ruc.Text.ToUpper() + "',tipoclieprov='" + cbo_tipo.EditValue.ToString() + "' where idempresa='" + VariablesGenerales.Empresa + "' and idclieprov='" + txt_codigo.Text.ToUpper() + "'");
                if (rpta.Equals("Ok"))
                {
                    LlegarGrilla();
                    botones(true);
                    activartxt(false);
                    MessageBox.Show("Actualizado Correctamente");
                }
            }
        }
        private void btn_guardar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (cbo_grupo.Text.Equals("[Seleccionar]"))
            {
                MessageBox.Show("Debe seleccionar Grupo !");
                return;
            }
            if (txt_codigo.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Codigo !");
                return;
            }
            if (txt_razonsocial.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Descripcion de Grupo !");
                return;
            }



            if (_modo.Equals("N"))
            {
                DataTable tb_table = new DataTable();
                tb_table = NFunciones.TABLASQL("SELECT * FROM tb_subgrupo WHERE idempresa='" + VariablesGenerales.Empresa + "' AND idgrupopro='" + txt_codigo.Text + "'");
                if (tb_table.Rows.Count > 0)
                {
                    MessageBox.Show("Ya existe el codigo ingresado debe colocar uno que nuevo !");
                    return;
                }


                string rpta = NFunciones.ExecuteSQL("insert into tb_subgrupo(idempresa,idsubgrupopro,idgrupopro,descripcion,estado) values('" + VariablesGenerales.Empresa + "','" + txt_codigo.Text + "','" + cbo_grupo.EditValue.ToString() + "','" + txt_razonsocial.Text + "','1')");
                if (rpta.Equals("Ok"))
                {
                    LlegarGrilla();
                    botones(true);
                    activartxt(false);
                    _modo = "";
                    MessageBox.Show("Guardado Correctamente");
                }
            }
            if (_modo.Equals("E"))
            {
                string rpta = NFunciones.ExecuteSQL("update tb_subgrupo set descripcion='" + txt_razonsocial.Text + "' where idempresa='" + VariablesGenerales.Empresa + "' and idgrupopro='" + cbo_grupo.EditValue.ToString() + "'");
                if (rpta.Equals("Ok"))
                {
                    LlegarGrilla();
                    botones(true);
                    activartxt(false);
                    _modo = "";
                    MessageBox.Show("Actualizado Correctamente");
                }
            }
        }
Esempio n. 9
0
        void llenarclienteproveedor()
        {
            if (_idoperacion.Equals("C"))
            {
                cbo_clieprov.Properties.DataSource    = NFunciones.TABLASQL("select idclieprov CODIGO,razonsocial PROVEEDOR from tb_clieprov where   idempresa='" + VariablesGenerales.Empresa + "'");
                cbo_clieprov.Properties.ValueMember   = "CODIGO";
                cbo_clieprov.Properties.DisplayMember = "PROVEEDOR";
            }

            if (_idoperacion.Equals("V"))
            {
                cbo_clieprov.Properties.DataSource    = NFunciones.TABLASQL("select idclieprov CODIGO,razonsocial PROVEEDOR from tb_clieprov where  idempresa='" + VariablesGenerales.Empresa + "'");
                cbo_clieprov.Properties.ValueMember   = "CODIGO";
                cbo_clieprov.Properties.DisplayMember = "PROVEEDOR";
            }
        }
Esempio n. 10
0
        private void btn_eliminar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataTable tb_op = new DataTable();

            if (txt_idoperacion.Text.Equals("C"))
            {
                tb_op = NFunciones.TABLASQL("SELECT * FROM tb_movcobrarpagardoc_drakback where idcobrarpagardoc='" + txt_id.Text + "' and idempresa='" + VariablesGenerales.Empresa + "' and not idtransaccion='" + txt_id.Text + "'");
            }
            if (txt_idoperacion.Text.Equals("V"))
            {
                tb_op = NFunciones.TABLASQL("select * from tb_docreferencia where idempresa='" + VariablesGenerales.Empresa + "' and idorigen='" + txt_id.Text + "'");
            }

            if (tb_op.Rows.Count > 0)
            {
                MessageBox.Show("No se Puede Eliminar el Documento esta Referenciado a otro Documento ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                DialogResult Result = MessageBox.Show("Esta Seguro de Eliminar el Documento", "Verificación !", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.Yes)
                {
                    string eliminarcabecera = NFunciones.ExecuteSQL("DELETE tb_cobrarpagardoc WHERE IDEMPRESA='" + VariablesGenerales.Empresa + "' AND idcobrarpagardoc='" + txt_id.Text + "'");
                    string detalle          = NFunciones.ExecuteSQL("DELETE tb_dcobrarpagardoc WHERE IDEMPRESA='" + VariablesGenerales.Empresa + "' AND idcobrarpagardoc='" + txt_id.Text + "'");
                    string mov = NFunciones.ExecuteSQL("DELETE tb_movcobrarpagardoc_drakback WHERE IDEMPRESA='" + VariablesGenerales.Empresa + "' AND idcobrarpagardoc='" + txt_id.Text + "' AND IDTRANSACCION='" + txt_id.Text + "'");
                    limpiartxt();
                    txt_id.Text = "";
                    LlegarGrilla();
                    MessageBox.Show("Se Elimino Correctamente", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    if (txt_idoperacion.Text.Equals("C"))
                    {
                        VariablesGenerales.refrescompras = "S";
                    }

                    if (txt_idoperacion.Text.Equals("V"))
                    {
                        VariablesGenerales.refresventas = "S";
                    }
                }
                else
                {
                    return;
                }
            }
        }
Esempio n. 11
0
        private void btn_nuevo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tipo = "N";
            DataTable tb_empresa = NFunciones.TABLASQL("SELECT * FROM TB_EMPRESA WHERE IDEMPRESA='" + VariablesGenerales.Empresa + "'");

            txt_tc.Text                  = tb_empresa.Rows[0]["TC"].ToString();
            txt_regimen.Text             = tb_empresa.Rows[0]["regimen"].ToString();
            txt_aduanas.Text             = tb_empresa.Rows[0]["codigo_aduanas"].ToString();
            txt_porc_drawback.Text       = tb_empresa.Rows[0]["porc_drawback"].ToString();
            dtp_fechaoperacion.EditValue = DateTime.Now.ToShortDateString();
            llenarExportacion();
            crearid();
            botones(true);
            dtg_exportaciones.DataSource = null;
            dtg_insumos.DataSource       = null;
            Program.detalleinsumos       = null;
        }
Esempio n. 12
0
        private void btn_guardar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (txt_codigo.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Codigo !");
                return;
            }
            if (txt_razonsocial.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Descripcion de Grupo !");
                return;
            }

            if (_modo.Equals("N"))
            {
                DataTable tb_table = new DataTable();
                tb_table = NFunciones.TABLASQL("select idgrupopro from tb_grupopro where idgrupopro='" + txt_codigo.Text + "' and idempresa='" + VariablesGenerales.Empresa + "'");
                if (tb_table.Rows.Count > 0)
                {
                    MessageBox.Show("Ya existe el codigo ingresado debe colocar uno que nuevo !");
                    return;
                }


                string rpta = NFunciones.ExecuteSQL("INSERT INTO tb_grupopro (idempresa,idgrupopro,descripcion,estado) VALUES('" + VariablesGenerales.Empresa + "','" + txt_codigo.Text + "','" + txt_razonsocial.Text + "','1')");
                if (rpta.Equals("Ok"))
                {
                    LlegarGrilla();
                    botones(true);
                    activartxt(false);
                    MessageBox.Show("Guardado Correctamente");
                }
            }
            if (_modo.Equals("E"))
            {
                string rpta = NFunciones.ExecuteSQL("update tb_grupopro set descripcion='" + txt_razonsocial.Text + "' where idempresa='" + VariablesGenerales.Empresa + "' and idgrupopro='" + txt_codigo.Text + "'");
                if (rpta.Equals("Ok"))
                {
                    LlegarGrilla();
                    botones(true);
                    activartxt(false);
                    MessageBox.Show("Actualizado Correctamente");
                }
            }
            _modo = "";
        }
Esempio n. 13
0
        private void btn_nuevo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            limpiartxt();
            botones(false);
            activartxt(true);
            crearid();
            LlegarGrilla();
            _opcion = "N";
            DataTable tc = NFunciones.TABLASQL("SELECT TC FROM tb_empresa WHERE idempresa='" + VariablesGenerales.Empresa + "'");

            if (tc.Rows.Count > 0)
            {
                MessageBox.Show("No a Ingresado Tipo de Cambio en la Configuración de la empresa", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                txt_tc.Text = tc.Rows[0]["TC"].ToString();
            }
        }
Esempio n. 14
0
 private void btn_agregarexportacion_Click(object sender, EventArgs e)
 {
     if (vista_exportaciones.RowCount > 0)
     {
         DialogResult result = MessageBox.Show("Esta Seguro de que Cambiar el detalle ?", "Alerta", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             dtg_exportaciones.DataSource = NFunciones.TABLASQL("SELECT c.idcobrarpagardoc ID,d.idproducto IDPRODUCTO,d.descripcion PRODUCTO,d.cantidad CANTIDAD,d.idunidad UNIDAD FROM tb_cobrarpagardoc c inner join tb_dcobrarpagardoc d on c.idcobrarpagardoc=d.idcobrarpagardoc and c.idempresa=d.idempresa WHERE c.idempresa='" + VariablesGenerales.Empresa + "' AND c.idcobrarpagardoc='" + cbo_exportaciones.EditValue.ToString() + "'");
             DataTable tb = NFunciones.TABLASQL("SELECT SUM(preciototal) TOTAL,sum(CANTIDAD) CAJAS FROM tb_dcobrarpagardoc WHERE idempresa='" + VariablesGenerales.Empresa + "' AND idcobrarpagardoc='" + cbo_exportaciones.EditValue.ToString() + "'");
             if (tb.Rows.Count > 0)
             {
                 txt_importetotal.Text = tb.Rows[0]["TOTAL"].ToString();
                 txt_ncajas.Text       = tb.Rows[0]["CAJAS"].ToString();
             }
         }
         else
         {
             return;
         }
     }
     else
     {
         //dtg_exportaciones.DataSource = NFunciones.TABLASQL("SELECT c.idcobrarpagardoc ID,d.idproducto IDPRODUCTO,d.descripcion PRODUCTO,d.cantidad CANTIDAD,d.idunidad UNIDAD FROM tb_cobrarpagardoc c inner join tb_dcobrarpagardoc d on c.idcobrarpagardoc=d.idcobrarpagardoc and c.idempresa=d.idempresa WHERE c.idempresa='"+VariablesGenerales.Empresa+"' AND c.idcobrarpagardoc='"+cbo_exportaciones.EditValue.ToString()+"'");
         dtg_exportaciones.DataSource = NFunciones.TABLASQL("SELECT c.idcobrarpagardoc ID,d.idproducto IDPRODUCTO,d.descripcion PRODUCTO,d.cantidad CANTIDAD,d.idunidad UNIDAD FROM tb_cobrarpagardoc c inner join tb_dcobrarpagardoc d on c.idcobrarpagardoc=d.idcobrarpagardoc and c.idempresa=d.idempresa WHERE c.idempresa='" + VariablesGenerales.Empresa + "' AND c.idcobrarpagardoc='" + cbo_exportaciones.EditValue.ToString() + "'");
         DataTable tb = NFunciones.TABLASQL("SELECT SUM(preciototal) TOTAL,sum(CANTIDAD) CAJAS  FROM tb_dcobrarpagardoc WHERE idempresa='" + VariablesGenerales.Empresa + "' AND idcobrarpagardoc='" + cbo_exportaciones.EditValue.ToString() + "'");
         if (tb.Rows.Count > 0)
         {
             txt_importetotal.Text = tb.Rows[0]["TOTAL"].ToString();
             txt_ncajas.Text       = tb.Rows[0]["CAJAS"].ToString();
         }
     }
     //if (vista_exportaciones.RowCount>0)
     //{
     //    cbo_exportaciones.Enabled = false;
     //}
     //else
     //{
     //    cbo_exportaciones.Enabled = true;
     //}
 }
Esempio n. 15
0
 void LlegarGrilla()
 {
     dtg_datos.DataSource = NFunciones.TABLASQL("select idgrupopro CODIGO,descripcion GRUPO from tb_grupopro where idempresa='" + VariablesGenerales.Empresa + "' ORDER BY idgrupopro ASC");
 }
Esempio n. 16
0
        private void Frm_Compra_Load(object sender, EventArgs e)
        {
            llenarclienteproveedor();
            llenardocumentos();
            llenarproductos();
            LlegarGrilla();
            llenarmedida();
            llenarmoneda();
            regimenimportacion();
            Puertoimportacion();

            if (_idoperacion.Equals("C"))
            {
                txt_idoperacion.Text       = "C";
                txt_operacion.Text         = "Compras";
                this.Text                  = "Compras";
                cbo_regimen.Visible        = true;
                cbo_puerto.Visible         = true;
                monoFlat_Label11.Visible   = true;
                monoFlat_Label12.Visible   = true;
                monoFlat_Label13.Visible   = true;
                monoFlat_Label14.Visible   = true;
                txt_dam.Visible            = true;
                txt_anoimportacion.Visible = true;
            }
            if (_idoperacion.Equals("V"))
            {
                txt_idoperacion.Text       = "V";
                txt_operacion.Text         = "Ventas";
                this.Text                  = "Ventas";
                cbo_regimen.Visible        = false;
                cbo_puerto.Visible         = false;
                monoFlat_Label11.Visible   = false;
                monoFlat_Label12.Visible   = false;
                monoFlat_Label13.Visible   = false;
                monoFlat_Label14.Visible   = false;
                txt_dam.Visible            = false;
                txt_anoimportacion.Visible = false;
            }
            if (_opcion.Equals("N"))
            {
                limpiartxt();
                txt_id.Text = _id;
                botones(false);
                activartxt(true);
                crearid();
                LlegarGrilla();
                _opcion = "N";

                DataTable tc = NFunciones.TABLASQL("SELECT TC FROM tb_empresa WHERE idempresa='" + VariablesGenerales.Empresa + "'");
                if (tc.Rows.Count < 1)
                {
                    MessageBox.Show("No a Ingresado Tipo de Cambio en la Configuración de la empresa", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    txt_tc.Text = tc.Rows[0]["TC"].ToString();
                }
            }
            if (_opcion.Equals("E"))
            {
                regimenimportacion();
                Puertoimportacion();
                DataTable tb_cabecera = NFunciones.TABLASQL("select * from tb_cobrarpagardoc where idempresa='" + VariablesGenerales.Empresa + "' and idcobrarpagardoc='" + _id + "'");
                if (tb_cabecera.Rows.Count > 0)
                {
                    txt_id.Text                  = tb_cabecera.Rows[0]["idcobrarpagardoc"].ToString();
                    cbo_clieprov.EditValue       = tb_cabecera.Rows[0]["idclieprov"].ToString();
                    dtp_fechadoc.EditValue       = tb_cabecera.Rows[0]["fecha"].ToString();
                    dtp_fechaoperacion.EditValue = tb_cabecera.Rows[0]["fechaoperacion"].ToString();
                    cbo_documento.EditValue      = tb_cabecera.Rows[0]["iddocumento"].ToString();
                    txt_serie.Text               = tb_cabecera.Rows[0]["serie"].ToString();
                    txt_numero.Text              = tb_cabecera.Rows[0]["numero"].ToString();
                    txt_idoperacion.Text         = tb_cabecera.Rows[0]["tipo"].ToString();
                    cbo_moneda.EditValue         = tb_cabecera.Rows[0]["idmoneda"].ToString();
                    txt_tc.Text                  = tb_cabecera.Rows[0]["TC"].ToString();
                    cbo_puerto.EditValue         = tb_cabecera.Rows[0]["idpuertoimportacion"].ToString();
                    cbo_regimen.EditValue        = tb_cabecera.Rows[0]["idregimenimportacion"].ToString();
                    txt_dam.Text                 = tb_cabecera.Rows[0]["dam"].ToString();
                    txt_anoimportacion.Text      = tb_cabecera.Rows[0]["anoimportacion"].ToString();

                    if (txt_idoperacion.Equals("C"))
                    {
                        txt_operacion.Text = "Compras";
                        this.Text          = "Compras";
                    }
                    if (txt_idoperacion.Equals("V"))
                    {
                        txt_operacion.Text = "Ventas";
                        this.Text          = "Ventas";
                    }
                    LlegarGrilla();
                }



                if (_idoperacion.Equals("C"))
                {
                    DataTable tb_table = new DataTable();
                    tb_table = NFunciones.TABLASQL("select * from tb_movcobrarpagardoc_drakback where idcobrarpagardoc='" + txt_id.Text + "' AND NOT idtransaccion='" + txt_id.Text + "' AND idempresa='" + VariablesGenerales.Empresa + "'");
                    if (tb_table.Rows.Count > 0)
                    {
                        botones(true);
                        activartxt(false);
                        _opcion = "";
                        MessageBox.Show("Este Registro Esta relacionado con otros Registro, No se puede realizar la operación !");
                        return;
                    }
                    else
                    {
                        botones(false);
                        activartxt(true);
                        _opcion = "E";
                    }
                }
                if (_idoperacion.Equals("V"))
                {
                    DataTable tb_table = new DataTable();
                    tb_table = NFunciones.TABLASQL("select * from tb_docreferencia where idempresa='" + VariablesGenerales.Empresa + "' and idorigen='" + txt_id.Text + "'");
                    if (tb_table.Rows.Count > 0)
                    {
                        botones(true);
                        activartxt(false);
                        _opcion = "";
                        MessageBox.Show("Este Registro Esta relacionado con otros Registro, No se puede realizar la operación !");
                        return;
                    }
                    else
                    {
                        botones(false);
                        activartxt(true);
                        _opcion = "E";
                    }
                }
            }


            if (_opcion.Equals("V"))
            {
                botones(true);
                activartxt(false);
                _opcion = "";
                llenarclienteproveedor();
                regimenimportacion();
                Puertoimportacion();
                DataTable tb_cabecera = NFunciones.TABLASQL("select * from tb_cobrarpagardoc where idempresa='" + VariablesGenerales.Empresa + "' and idcobrarpagardoc='" + _id + "'");
                if (tb_cabecera.Rows.Count > 0)
                {
                    txt_id.Text            = tb_cabecera.Rows[0]["idcobrarpagardoc"].ToString();
                    cbo_clieprov.EditValue = tb_cabecera.Rows[0]["idclieprov"].ToString();
                    dtp_fechadoc.EditValue = Convert.ToDateTime(tb_cabecera.Rows[0]["fecha"].ToString());
                    //dtp_fechaoperacion.EditValue = tb_cabecera.Rows[0]["fechaoperacion"].ToString();
                    cbo_documento.EditValue = tb_cabecera.Rows[0]["iddocumento"].ToString();
                    txt_serie.Text          = tb_cabecera.Rows[0]["serie"].ToString();
                    txt_numero.Text         = tb_cabecera.Rows[0]["numero"].ToString();
                    txt_idoperacion.Text    = tb_cabecera.Rows[0]["tipo"].ToString();
                    cbo_moneda.EditValue    = tb_cabecera.Rows[0]["idmoneda"].ToString();
                    txt_tc.Text             = tb_cabecera.Rows[0]["TC"].ToString();
                    cbo_puerto.EditValue    = tb_cabecera.Rows[0]["idpuertoimportacion"].ToString();
                    cbo_regimen.EditValue   = tb_cabecera.Rows[0]["idregimenimportacion"].ToString();
                    txt_dam.Text            = tb_cabecera.Rows[0]["dam"].ToString();
                    txt_anoimportacion.Text = tb_cabecera.Rows[0]["anoimportacion"].ToString();
                    if (txt_idoperacion.Equals("C"))
                    {
                        txt_operacion.Text = "Compras";
                        this.Text          = "Compras";
                    }
                    if (txt_idoperacion.Equals("V"))
                    {
                        txt_operacion.Text = "Ventas";
                        this.Text          = "Ventas";
                    }
                    LlegarGrilla();
                }
            }

            vista_datos.Columns["TOTAL"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "SUBTOTAL", "Sub Total:  {0:n4}");
            vista_datos.Columns["TOTAL"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "IMPUESTO", "Impuesto:  {0:n4}");
            vista_datos.Columns["TOTAL"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "TOTAL", "TOTAL:  {0:n4}");
        }
Esempio n. 17
0
 void llenargrupo()
 {
     cbo_grupo.Properties.DataSource    = NFunciones.TABLASQL("select idgrupopro CODIGO,descripcion DESCRIPCION from tb_grupopro where idempresa='" + VariablesGenerales.Empresa + "' ORDER BY idgrupopro ASC");
     cbo_grupo.Properties.ValueMember   = "CODIGO";
     cbo_grupo.Properties.DisplayMember = "DESCRIPCION";
 }
Esempio n. 18
0
 void LlegarGrilla()
 {
     dtg_datos.DataSource = NFunciones.TABLASQL("select S.idgrupopro IDGRUPO,G.descripcion GRUPO,S.idsubgrupopro CODIGO,S.descripcion SUBGRUPO from tb_subgrupo S  INNER JOIN tb_grupopro G ON G.idgrupopro=S.idgrupopro AND S.idempresa=G.idempresa where S.idempresa='" + VariablesGenerales.Empresa + "' ORDER BY S.idgrupopro,S.idsubgrupopro ASC");
 }
 void LlegarGrilla()
 {
     dtg_datos.DataSource = NFunciones.TABLASQL("Select idcobrarpagardoc ID,iddocumento+' '+serie+' '+numero DOC,idclieprov IDCLIEPROV,RAZONSOCIAL,fecha FECHA,estado IDESTADO,CASE ESTADO WHEN '0' THEN 'ANULADO' ELSE 'ACTIVADO' END ESTADO from tb_cobrarpagardoc where idempresa='" + VariablesGenerales.Empresa + "' AND TIPO='C'");
 }
Esempio n. 20
0
 void llenarInsumos()
 {
     pvt_datos.DataSource = NFunciones.TABLASQL("SELECT X.idcobrarpagardoc ID,C.iddocumento+' '+C.serie+' - '+C.numero DOCUMENTO,C.idclieprov IDPROVEEDOR,C.razonsocial PROVEEDOR,X.idproducto IDPRODUCTO,X.descripcion PRODUCTO,X.idunidad UNIDAD,X.stock CANTIDAD FROM (SELECT SUM(cantidad*factor) stock,idcobrarpagardoc,idproducto,descripcion,idunidad FROM tb_movcobrarpagardoc_drakback M where SUBSTRING(idcobrarpagardoc,1,1)='C' AND idempresa='" + VariablesGenerales.Empresa + "' group by idcobrarpagardoc,idproducto,descripcion,idunidad)X INNER JOIN tb_cobrarpagardoc C ON X.idcobrarpagardoc=C.idcobrarpagardoc WHERE X.stock>0 AND C.idempresa='" + VariablesGenerales.Empresa + "'");
 }
Esempio n. 21
0
 void llenarMedida()
 {
     cbo_medida.Properties.DataSource    = NFunciones.TABLASQL("select idunidad CODIGO,descripcion UNIDAD_MONEDA from conf_unimedida");
     cbo_medida.Properties.ValueMember   = "CODIGO";
     cbo_medida.Properties.DisplayMember = "UNIDAD_MONEDA";
 }
Esempio n. 22
0
 void llenarsubgrupo(string idgrupo)
 {
     cbo_subgrupo.Properties.DataSource    = NFunciones.TABLASQL("SELECT idsubgrupopro CODIGO,descripcion SUBGRUPO FROM tb_subgrupo WHERE idgrupopro='" + idgrupo + "' AND idempresa='" + VariablesGenerales.Empresa + "'");
     cbo_subgrupo.Properties.ValueMember   = "CODIGO";
     cbo_subgrupo.Properties.DisplayMember = "SUBGRUPO";
 }
Esempio n. 23
0
 void LlegarGrilla()
 {
     dtg_datos.DataSource = NFunciones.TABLASQL("SELECT p.idproducto CODIGO,p.idgrupopro IDGRUPO,g.descripcion GRUPO,p.idsubgrupopro IDSUBGRUPO,s.descripcion SUBGRUPO,p.descripcion PRODUCTO,p.idunidad IDMEDIDA,u.descripcion MEDIDA FROM tb_productos p  inner join tb_grupopro g on g.idempresa=p.idempresa and g.idgrupopro=p.idgrupopro inner join tb_subgrupo s on s.idempresa=p.idempresa and s.idgrupopro=g.idgrupopro and s.idsubgrupopro=p.idsubgrupopro INNER JOIN conf_unimedida u on u.idunidad=p.idunidad WHERE p.idempresa='" + VariablesGenerales.Empresa + "'");
 }
Esempio n. 24
0
 void llenarEmpresa()
 {
     cbo_empresaseleccionada.Properties.DataSource    = NFunciones.TABLASQL("select idempresa Codigo,razonsocial Empresa from tb_empresa order by idempresa asc");
     cbo_empresaseleccionada.Properties.ValueMember   = "Codigo";
     cbo_empresaseleccionada.Properties.DisplayMember = "Empresa";
 }
Esempio n. 25
0
 void LlegarGrilla()
 {
     dtg_datos.DataSource = NFunciones.TABLASQL("SELECT IDEMPRESA,RAZONSOCIAL,DIRECCION,telef TELEFONO,email EMAIL,RUC,TC,codigo_aduanas CODIGOADUANAS,regimen CODIGOREGIMEN,porc_drawback  FROM tb_empresa ORDER BY idempresa ASC");
 }
Esempio n. 26
0
        private void btn_guardar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (txt_codempresa.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Codigo de Empresa !");
                return;
            }
            if (txt_razonsocial.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Razon Social !");
                return;
            }
            if (txt_ruc.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Ruc!");
                return;
            }
            if (txt_direccion.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Dirección !");
                return;
            }
            if (txt_razonsocial.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Razon Social !");
                return;
            }
            if (txt_tcambio.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Tipo de Cambio !");
                return;
            }
            if (txt_codigoaduanas.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Codigo Aduanas !");
                return;
            }
            if (txt_regimen.Text.Equals(""))
            {
                MessageBox.Show("Debe Ingresar Codigo de Regimen !");
                return;
            }



            if (_modo.Equals("N"))
            {
                DataTable tb_table = new DataTable();
                tb_table = NFunciones.TABLASQL("select idempresa from tb_empresa where idempresa='" + txt_codempresa.Text + "'");
                if (tb_table.Rows.Count > 0)
                {
                    MessageBox.Show("Ya existe el codigo ingresado debe colocar uno que nuevo !");
                    return;
                }


                string rpta = NFunciones.ExecuteSQL("insert into tb_empresa (idempresa,razonsocial,direccion,telef,email,ruc,TC,codigo_aduanas,regimen,porc_drawback) values('" + txt_codempresa.Text.ToUpper() + "','" + txt_razonsocial.Text.ToUpper() + "','" + txt_direccion.Text.ToUpper() + "','" + txt_telefono.Text.ToUpper() + "','" + txt_email.Text.ToUpper() + "','" + txt_ruc.Text.ToUpper() + "','" + txt_tcambio.Text.ToUpper() + "','" + txt_codigoaduanas.Text.ToUpper() + "','" + txt_regimen.Text.ToUpper() + "','" + txt_porc_drawback.Text + "')");
                if (rpta.Equals("Ok"))
                {
                    LlegarGrilla();
                    botones(true);
                    activartxt(false);
                    MessageBox.Show("Guardado Correctamente");
                }
            }
            if (_modo.Equals("E"))
            {
                string rpta = NFunciones.ExecuteSQL("UPDATE tb_empresa SET razonsocial='" + txt_razonsocial.Text.ToUpper() + "',direccion='" + txt_direccion.Text.ToUpper() + "',telef='" + txt_telefono.Text.ToUpper() + "',email='" + txt_email.Text.ToUpper() + "',ruc='" + txt_ruc.Text.ToUpper() + "',TC='" + txt_tcambio.Text + "',codigo_aduanas='" + txt_codigoaduanas.Text + "', regimen='" + txt_regimen.Text + "',porc_drawback='" + txt_porc_drawback.Text + "'   WHERE idempresa='" + txt_codempresa.Text + "'");
                if (rpta.Equals("Ok"))
                {
                    LlegarGrilla();
                    botones(true);
                    activartxt(false);
                    MessageBox.Show("Actualizado Correctamente");
                }
            }
        }
 void LlegarGrilla()
 {
     dtg_datos.DataSource = NFunciones.TABLASQL("SELECT idclieprov CODIGO,razonsocial RAZONSOCIAL,RUC,tipoclieprov IDTIPO,T.DESCRIPCION TIPO,ESTADO IDESTADO,CASE ESTADO  WHEN '1' THEN 'ACTIVO' ELSE 'DESACTIVADO' END ESTADO FROM tb_clieprov c  LEFT JOIN conf_tipo t on t.IDTIPOCLIEPROV=C.tipoclieprov where c.idempresa='" + VariablesGenerales.Empresa + "'");
 }
Esempio n. 28
0
        private void btn_actualizar_Click(object sender, EventArgs e)
        {
            try
            {
                string ext  = Path.GetExtension(txt_ruta.Text);
                string hoja = "ImportarVentas";
                dtlote = ImportarExcel(txt_ruta.Text, ext, hoja);

                if (dtlote.Rows.Count > 0)
                {
                    if (dtlote.Columns.Count > 13 || dtlote.Columns.Count < 13)
                    {
                        MessageBox.Show(@"El archivo no es correcto , intente abrir el archivo correcto ");
                        estado = "S";
                    }
                    else
                    {
                        //
                        string errores      = "";
                        int    contador     = 0;
                        string ruta         = "c:\\DATA";
                        string rutaCompleta = ruta + "\\" + "Errores.txt";
                        if (!Directory.Exists(ruta))
                        {
                            Directory.CreateDirectory(ruta);
                        }

                        if (File.Exists(rutaCompleta))
                        {
                            File.Delete(rutaCompleta);
                        }

                        foreach (DataRow row in dtlote.Rows)
                        {
                            contador++;
                            if (row[0].ToString().Length < 3 || row[0].ToString().Length > 3)
                            {
                                errores = "Debe Tener 3 digitos " + "\n";
                            }
                            DataTable dtemp = NFunciones.TABLASQL("select * from tb_empresa where idempresa='" + row[0].ToString() + "'");
                            if (dtemp.Rows.Count == 0)
                            {
                                errores = "No Existe la Empresa " + "\n";
                            }

                            DataTable dtDOC = NFunciones.TABLASQL("SELECT * FROM TB_DOCUMENTOS WHERE iddocumento='" + row[1].ToString() + "'");

                            if (dtDOC.Rows.Count == 0)
                            {
                                errores = "No Existe el documento" + "\n";
                            }
                            if (row[2].ToString().Length < 4 || row[2].ToString().Length > 4)
                            {
                                errores = "Debe Tener 4 digitos : serie " + "\n";
                                MessageBox.Show(row[2].ToString());
                            }

                            if (row[3].ToString().Length < 7 || row[3].ToString().Length > 7)
                            {
                                errores = "Debe Tener 7 digitos : Numero" + "\n";
                            }
                            DataTable dtclieprv = NFunciones.TABLASQL("select * from tb_clieprov where idclieprov='" + row[4].ToString() + "' and idempresa='" + row[0].ToString() + "' and tipoclieprov in ('001','003')");
                            if (dtemp.Rows.Count == 0)
                            {
                                errores = "No Existe la Codigo de Cliente " + "\n";
                            }
                            if (string.IsNullOrEmpty(row[5].ToString()))
                            {
                                errores = "Debe ingresar fecha : idempresa " + "\n";
                            }

                            //moneda
                            DataTable dtidmoneda = NFunciones.TABLASQL("select * from tb_moneda where idmoneda='" + row[6].ToString() + "'");
                            if (dtidmoneda.Rows.Count == 0)
                            {
                                errores = "No Existe el moneda " + "\n";
                            }
                            //tc
                            if (string.IsNullOrEmpty(row[7].ToString()))
                            {
                                errores = "Debe ingresar : T.C " + "\n";
                            }
                            if (Convert.ToDouble(row[7].ToString()) < 1)
                            {
                                errores = "Debe ingresar : T.C " + "\n";
                            }
                            //producto

                            DataTable dtproduc = NFunciones.TABLASQL("select * from tb_productos where idproducto='" + row[9].ToString() + "' and idempresa='" + row[0].ToString() + "'");
                            if (dtproduc.Rows.Count == 0)
                            {
                                errores = "No Existe el Producto " + "\n";
                            }
                            //cantidad
                            if (string.IsNullOrEmpty(row[10].ToString()))
                            {
                                errores = "Debe ingresar : Cantidad " + "\n";
                            }
                            if (Convert.ToDouble(row[10].ToString()) < 0)
                            {
                                errores = "Debe ingresar : Cantidad " + "\n";
                            }

                            if (Convert.ToDouble(row[12].ToString()) < 0)
                            {
                                errores = "Debe ingresar : Precio Unitario" + "\n";
                            }
                            DataTable dtventas = NFunciones.TABLASQL("SELECT * FROM tb_cobrarpagardoc where iddocumento='" + row[1].ToString() + "' and serie='" + row[2].ToString() + "' and numero='" + row[3].ToString() + "' and idclieprov='" + row[4].ToString() + "' and idempresa='" + row[0].ToString() + "'");
                            if (dtventas.Rows.Count > 0)
                            {
                                errores = "Ya existe el documento : " + row[1].ToString() + " " + row[2].ToString() + "-" + row[3].ToString() + "\n";
                            }
                        }

                        if (!errores.Equals(""))
                        {
                            using (StreamWriter file = new StreamWriter(rutaCompleta, true))
                            {
                                file.WriteLine("Lista de Errores encontrados , Revisar !!! - WARSOFT SOLUCIONES INFORMATICAS");
                                file.WriteLine(errores);
                                file.Close();
                                ProcessStartInfo psi = new ProcessStartInfo("notepad.exe", rutaCompleta);
                                Process          p   = Process.Start(psi);
                            }
                        }
                        else
                        {
                            Insertando();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
 void Llenartipo()
 {
     cbo_tipo.Properties.DataSource    = NFunciones.TABLASQL("SELECT IDTIPOCLIEPROV CODIGO,DESCRIPCION TIPO FROM CONF_TIPO ORDER BY IDTIPOCLIEPROV ASC");
     cbo_tipo.Properties.ValueMember   = "CODIGO";
     cbo_tipo.Properties.DisplayMember = "TIPO";
 }
Esempio n. 30
0
 void llenarExportacion()
 {
     cbo_exportaciones.Properties.DataSource    = NFunciones.TABLASQL("SELECT d.idcobrarpagardoc CODIGO,D.iddocumento+' '+D.serie+'-'+D.numero+'----'+CONVERT(NVARCHAR(10), D.fecha,103) OPERACION FROM tb_cobrarpagardoc  D where d.tipo='V'  AND d.idempresa='" + VariablesGenerales.Empresa + "' AND NOT d.idcobrarpagardoc IN (SELECT idorigen FROM tb_docreferencia where idempresa='" + VariablesGenerales.Empresa + "') ORDER BY D.fecha ASC");
     cbo_exportaciones.Properties.ValueMember   = "CODIGO";
     cbo_exportaciones.Properties.DisplayMember = "OPERACION";
 }