Exemplo n.º 1
0
        private void sbrModifCampoLineas(string vCampo, string vValor)
        {
            cPedidosVenta.LinVenta linp = (cPedidosVenta.LinVenta)bS2.Current;

            if (linp.aCampoModif != "")
            {
                vCampo = linp.aCampoModif;
            }
            if (linp.aValor != "")
            {
                vValor = linp.aValor;
            }

            if (!linp.fncGrabaCampo(vCampo, vValor))
            {
                if ((linp.aError != "") & (linp.aError != null))
                {
                    MessageBox.Show(linp.aError);
                }
                bS2.CancelEdit();
            }

            if (vCampo == "Producto")
            {
                sbrActuProd(vValor);
            }
        }
Exemplo n.º 2
0
        //private string fncFiltros()
        //{
        //    string vFil = "";
        //    StringBuilder sb = new StringBuilder();
        //    foreach (C1.Win.C1TrueDBGrid.C1DataColumn dc in this.grPropiedades.Columns)
        //    {
        //        if (dc.FilterText.Length > 0)
        //        {
        //            //if (sb.Length > 0)
        //            //{
        //            sb.Append(" AND ");
        //            //}
        //            string vCampo = dc.DataField;
        //            vCampo = vCampo.Replace("ç", " ");
        //            if (vCampo.LastIndexOf('[') == -1) { vCampo = "[" + vCampo + "]"; }
        //            sb.Append("(" + vCampo + " like " + "'%" + dc.FilterText + "%'" + ")");
        //        }
        //    }
        //    // Filtrado de datos

        //    vFil = sb.ToString();


        //    return vFil;
        //}

        private void sbrRefrescarLinPed()
        {
            cPedidosVenta.LinVenta linp = (cPedidosVenta.LinVenta)bS2.Current;
            int vPed = linp.NumPed;
            int vReg = bS2.Position;

            sbrActuDatosLinPed(linp.NumPed.ToString());
            vReg         = cPedidosVenta.fncBuscaIndexLinPed(bS2, vPed.ToString());
            bS2.Position = vReg;
        }
Exemplo n.º 3
0
        private bool fncBajaLinea()
        {
            bool vOk = true;

            if (bS2.Current != null)
            {
                if (txEnPrep.Text != "0")
                {
                    MessageBox.Show("Esta Linea esta en PREPARACIÓN NO se puede eliminar");
                    bS2.CancelEdit();
                    vOk = false;
                    return(vOk);
                }

                cPedidosVenta.LinVenta linp = (cPedidosVenta.LinVenta)bS2.Current;
                if (linp.CantidadServida > 0)
                {
                    MessageBox.Show("Esta Linea tiene cantidad servida NO se puede eliminar");
                    bS2.CancelEdit();
                    vOk = false;
                    return(vOk);
                }
                string vMen = "Esta seguro de Eliminar la linea?";
                string vTit = "Eliminar";
                if (MessageBox.Show(vMen, vTit, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    try
                    {
                        if (!linp.fncBaja(linp.NumPed.ToString()))
                        {
                            MessageBox.Show("No se ha podido Eliminar la propiedad");
                            bS2.CancelEdit();
                            vOk = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("No se ha podido Eliminar la linea :'" + ex.Message + "'");
                        bS2.CancelEdit();
                        vOk = false;
                    }
                }
                else
                {
                    bS2.CancelEdit();
                    vOk = false;
                }
            }
            return(vOk);
        }
Exemplo n.º 4
0
        private bool fncAltaLinea()
        {
            bool vOk = false;

            cPedidosVenta.LinVenta cLinVenta = new cPedidosVenta.LinVenta();
            if (txCajas.Text == "")
            {
                txCajas.Text = "0";
            }
            if (txCan.Text == "")
            {
                txCan.Text = "0";
            }
            if (txDTO.Text == "")
            {
                txDTO.Text = "0";
            }
            if (txDTOLin.Text == "")
            {
                txDTOLin.Text = "0";
            }
            if (txIva.Text == "")
            {
                txIva.Text = "0";
            }
            if (txPrecio.Text == "")
            {
                txPrecio.Text = "0";
            }


            cLinVenta.Cajas             = Convert.ToInt32(txCajas.Text);
            cLinVenta.Cantidad          = Convert.ToDecimal(txCan.Text);
            cLinVenta.CantidadPendiente = 0;
            cLinVenta.CantidadServida   = 0;
            cLinVenta.Descripción       = txDesProd.Text;
            cLinVenta.DTO          = Convert.ToDecimal(txDTO.Text);
            cLinVenta.DTOLin       = Convert.ToDecimal(txDTOLin.Text);
            cLinVenta.Empresa      = cParamXml.Emp;
            cLinVenta.FechaEntrega = dTEntrega.Value;
            cLinVenta.IVA          = Convert.ToInt16(txIva.Text);
            cLinVenta.Lote         = txLote.Text;
            cLinVenta.NumPed       = Convert.ToInt32(txPed.Text);
            cLinVenta.Precio       = Convert.ToDecimal(txPrecio.Text);
            cLinVenta.Producto     = txProd.Text;
            vOk = cLinVenta.fncAltaLin();

            return(vOk);
        }
Exemplo n.º 5
0
        private void grPrep_CellValidated(object sender, DataGridViewCellEventArgs e)
        {
            string vVal = "0";

            try
            {
                vVal = grPrep.Rows[e.RowIndex].Cells["Prioridad"].Value.ToString();
            }
            catch { }
            cPedidosVenta.LinVenta oLinventa = new cPedidosVenta.LinVenta();

            oLinventa.Id     = Convert.ToInt32(txID.Text);
            oLinventa.ValAnt = txPrio.Text;

            if (oLinventa.fncGrabaCampo("Prioridad", vVal))
            {
            }
        }
Exemplo n.º 6
0
        private void btCambiar_Click(object sender, EventArgs e)
        {
            string vMen = "Se cambiara la prioridad de la lina selecionada.Esta seguro?";
            string vTit = "Prioridades";

            if (MessageBox.Show(vMen, vTit, MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            cPedidosVenta.LinVenta oLinventa = new cPedidosVenta.LinVenta();

            oLinventa.Id     = Convert.ToInt32(txID.Text);
            oLinventa.ValAnt = txPrio.Text;

            if (oLinventa.fncGrabaCampo("Prioridad", upPrio.Value.ToString()))
            {
                sbrCargar();
            }
        }
Exemplo n.º 7
0
        private bool fncCreaLinea(int vPrep, int vPed, int vLin)
        {
            bool vOk = false;

            try
            {
                cPedidosVenta.CabVenta    oCabVenta = new cPedidosVenta.CabVenta();
                cPedidosVenta.LinVenta    oLinVenta = new cPedidosVenta.LinVenta();
                cEntregas.LinPrepEntregas oLinEnt   = new cEntregas.LinPrepEntregas();

                //Traemos los datos de la cabezera del Pedido
                oCabVenta.fncTrae(vPed);

                //Traemos loa datos de la linea del pedido
                oLinVenta.fncTrae(vPed, vLin);

                //Los cargamos en la linea de la entrega
                oLinEnt.Empresa         = oLinVenta.Empresa;
                oLinEnt.NumPrep         = vPrep;
                oLinEnt.Producto        = oLinVenta.Producto;
                oLinEnt.Descripción     = oLinVenta.Descripción;
                oLinEnt.Cantidad        = oLinVenta.CantidadPendiente;
                oLinEnt.Lote            = oLinVenta.Lote;
                oLinEnt.CantidadServida = 0;
                oLinEnt.CanPen          = oLinVenta.CantidadPendiente;
                oLinEnt.FechaEntrega    = oLinVenta.FechaEntrega;
                oLinEnt.PedLocal        = vPed.ToString();
                oLinEnt.LinPedLocal     = vLin;
                oLinEnt.PedCliente      = oCabVenta.SuPedido;

                //Damos de alta la linea
                vOk = oLinEnt.fncAltaLin();
            }
            catch { vOk = false; }

            return(vOk);
        }
Exemplo n.º 8
0
        private void btGrabar_Click(object sender, EventArgs e)
        {
            if (lbSitu.Text == "Modificación")
            {
                if (txCanSer.Text != "")
                {
                    decimal vCanSer = Convert.ToDecimal(txCanSer.Text);
                    decimal vCan    = Convert.ToDecimal(txCan.Text);
                    if (vCan < vCanSer)
                    {
                        MessageBox.Show("La cantidad no puede ser menor que la cantidad servida");
                        return;
                    }
                }
                cPedidosVenta.LinVenta cLinVenta = new cPedidosVenta.LinVenta();

                DataGridViewRow dr  = grLinPed.CurrentRow;
                int             vId = Convert.ToInt32(dr.Cells["Id"].Value.ToString());
                cLinVenta.Id = vId;


                string vCT  = txProd.Tag.ToString();
                string vTx  = txProd.Text;
                string vVal = dr.Cells[vCT].Value.ToString();
                if (vTx != vVal)
                {
                    cLinVenta.fncGrabaCampo(vCT, vTx);
                }

                vCT  = txDesProd.Tag.ToString();
                vTx  = txDesProd.Text;
                vVal = dr.Cells[vCT].Value.ToString();
                if (vTx != vVal)
                {
                    cLinVenta.fncGrabaCampo(vCT, vTx);
                }


                vCT  = txPrecio.Tag.ToString();
                vTx  = txPrecio.Text;
                vVal = dr.Cells[vCT].Value.ToString();
                if (vTx != vVal)
                {
                    cLinVenta.fncGrabaCampo(vCT, vTx);
                }

                vCT  = txIva.Tag.ToString();
                vTx  = txIva.Text;
                vVal = dr.Cells[vCT].Value.ToString();
                if (vTx != vVal)
                {
                    cLinVenta.fncGrabaCampo(vCT, vTx);
                }

                vCT  = txCan.Tag.ToString();
                vTx  = txCan.Text;
                vVal = dr.Cells[vCT].Value.ToString();
                if (vTx != vVal)
                {
                    cLinVenta.fncGrabaCampo(vCT, vTx);
                }

                vCT  = dTEntrega.Tag.ToString();
                vTx  = dTEntrega.Text;
                vVal = dr.Cells[vCT].Value.ToString();
                if (vTx != vVal)
                {
                    cLinVenta.fncGrabaCampo(vCT, vTx);
                }

                vCT  = txLote.Tag.ToString();
                vTx  = txLote.Text;
                vVal = dr.Cells[vCT].Value.ToString();
                if (vTx != vVal)
                {
                    cLinVenta.fncGrabaCampo(vCT, vTx);
                }

                sbrCargaLineas(txPed.Text);
                sbrLimpiaEnt();
                txProd.Focus();
            }

            if (lbSitu.Text == "Alta")
            {
                if (txProd.Text == "")
                {
                    MessageBox.Show("El Producto NO esta informado");
                    txProd.Focus();
                    return;
                }
                if ((txCan.Text == "") | (txCan.Text == "0"))
                {
                    MessageBox.Show("La cantidad NO esta informada");
                    txCan.Focus();
                    return;
                }

                if (fncAltaLinea())
                {
                    sbrCargaLineas(txPed.Text);
                    sbrLimpiaEnt();
                    txProd.Focus();
                }
            }
        }
Exemplo n.º 9
0
        private void sbrProcesoPedCli()
        {
            if (cParamXml.ActPedCli == "False")
            {
                return;
            }

            tiProces.Enabled = false;
            lbMen.Text       = "Procesando Pedidos de Cliente";
            Application.DoEvents();
            DataTable dt = new DataTable();

            string vNumSerie = SQLDataAccess.GenTraeNumSerie(cParamXml.NSerPedCli, false, cParamXml.strConec);

            string vSql = cConstantes.SQL_CabPed_Dbf;

            vSql = vSql.Replace("[?vbCr]", cConstantes.vbCtr.ToString());
            vSql = vSql.Replace("[?vbLf]", cConstantes.vbLF.ToString());
            vSql = vSql.Replace("[?NumPed]", vNumSerie);

            try
            {
                dt = SQLDataAccess.TraeDBF(vSql, cUtil.DBFConec(cParamXml.strOleDBConecDbf));
                cPedidosVenta.CabVenta oCabPed = new cPedidosVenta.CabVenta();
                cPedidosVenta.LinVenta oLinPed = new cPedidosVenta.LinVenta();
                string vNumPed = "";
                string vErr    = "";
                foreach (DataRow dr in dt.Rows)
                {
                    vNumPed = dr["nnumped"].ToString();

                    if (oCabPed.fncAlta(dr))
                    {
                        string vSql2 = cConstantes.SQL_LinPed_Dbf;
                        vSql2 = vSql2.Replace("[?vbCr]", cConstantes.vbCtr.ToString());
                        vSql2 = vSql2.Replace("[?vbLf]", cConstantes.vbLF.ToString());
                        vSql2 = vSql2.Replace("[?NumPed]", vNumPed);
                        DataTable dt2 = SQLDataAccess.TraeDBF(vSql2, cUtil.DBFConec(cParamXml.strOleDBConecDbf));
                        foreach (DataRow dr2 in dt2.Rows)
                        {
                            //DataRow dr2 = dt2.Rows[0];
                            if (!oLinPed.fncAltaLin(dr2))
                            {
                                vErr         = oLinPed.Error;
                                lbError.Text = vErr;
                                Application.DoEvents();
                                Thread.Sleep(5000);
                            }
                        }
                    }
                    else
                    {
                        vErr         = oCabPed.Error;
                        lbError.Text = vErr;
                        Application.DoEvents();
                        Thread.Sleep(5000);
                    }
                    SQLDataAccess.GenSetNumSerie(cParamXml.NSerPedCli, vNumPed, cParamXml.strConec);
                }
            }
            catch (Exception ex)
            {
                lbError.Text = DateTime.Now.ToLongDateString() + "-- " + ex.Message;
            }


            lbMen.Text = "";
            Application.DoEvents();
            tiProces.Enabled = true;
        }