public void PutExtraData(ProcessCollectionData _processCollectionData)
        {
            foreach (TaskCollectionData data in _processCollectionData)
            {
                if (data.TaskName.Equals("ConfirmarIngresoMercaderia"))
                {
                    string idComprobante       = string.Empty;
                    string IdTipoDeComprobante = string.Empty;

                    foreach (DataSet dataset in data)
                    {
                        if (dataset.DataSetName.Equals("tpu_ComprobantesDetDataset"))
                        {
                            _dataDetComprobantePrevio = (tpu_ComprobantesDetDataset)dataset;
                        }
                    }
                }
                if (data.TaskName.Equals("ConfirmarPreciosProductosCompras"))
                {
                    string idComprobante       = string.Empty;
                    string IdTipoDeComprobante = string.Empty;

                    foreach (DataSet dataset in data)
                    {
                        if (dataset.DataSetName.Equals("tpu_ComprobantesDeCompraDetConfirmacionDePreciosDataset"))
                        {
                            _dataConfirmacionDet = (tpu_ComprobantesDeCompraDetConfirmacionDePreciosDataset)dataset;
                        }
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Envia los cambios del tpu_ComprobantesDetDataset a la base de datos.
        /// </summary>
        public static void Update(tpu_ComprobantesDetDataset dataSet)
        {
            ApplicationAssert.Check(dataSet != null, "El argumento dataSet no debe ser nulo.", ApplicationAssert.LineNumber);
            ApplicationAssert.Check(dataSet.tpu_ComprobantesDet.Rows.Count > 0, "La tabla dataSet.tpu_ComprobantesDetDataTable debe poseer alguna fila.", ApplicationAssert.LineNumber);

            mz.erp.dataaccess.tpu_ComprobantesDet.Update(dataSet);
        }
예제 #3
0
        public static tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow GetByPk(string IdComprobante, long Ordinal)
        {
            tpu_ComprobantesDetDataset data = new tpu_ComprobantesDetDataset();

            SqlCommand cmd = new SqlCommand("Pr_tpu_ComprobantesDet_GetByPk", dbhelper.Connection.GetConnection());

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add(new SqlParameter("@IdComprobante", SqlDbType.VarChar));
            cmd.Parameters["@IdComprobante"].Value = IdComprobante;

            cmd.Parameters.Add(new SqlParameter("@Ordinal", SqlDbType.BigInt));
            cmd.Parameters["@Ordinal"].Value = Ordinal;

            SqlDataAdapter adapter = new SqlDataAdapter(cmd);

            adapter.TableMappings.Add("Table", "tpu_ComprobantesDet");

            adapter.Fill(data);

            if (data.tpu_ComprobantesDet.Rows.Count == 1)
            {
                return((tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow)data.tpu_ComprobantesDet.Rows[0]);
            }

            return(null);
        }
예제 #4
0
        public static tpu_ComprobantesDetDataset GetList(string IdComprobante, string IdProducto, long Ordinal)
        {
            tpu_ComprobantesDetDataset data = new tpu_ComprobantesDetDataset();

            data = (tpu_ComprobantesDetDataset)GetList((System.Data.DataSet)data, IdComprobante, IdProducto, Ordinal);
            return(data);
        }
        public RelacionesComprobanteDeCompraOrigenDestino(ArrayList IdComprobantes)
        {
            string IdTipoDeComprobanteGral = String.Empty;

            ArrayList lista = new ArrayList(IdComprobantes);

            for (int i = 0; i < lista.Count; i++)
            {
                string IdComprobante = lista[i].ToString();
                tpu_ComprobantesDataset.tpu_ComprobantesRow CompOrigen = tpu_Comprobantes.GetByPk(IdComprobante);

                //Datos comunes a todos los items de un mismo comprobante
                string   IdTipoDeComprobante = CompOrigen.IdTipoDeComprobante;
                string   Numero         = CompOrigen.Numero;
                long     OrdinalOrigen  = -1;
                decimal  CantidadOrigen = 0;
                string   IdProducto     = String.Empty;
                string   Descripcion    = String.Empty;
                long     IdSucursal     = Security.IdSucursal;
                long     IdEmpresa      = Security.IdEmpresa;
                DateTime Fecha          = CompOrigen.Fecha;
                Decimal  PrecioDeCosto  = 0;
                this.IdProveedor   = CompOrigen.IdProveedor;
                this.IdResponsable = CompOrigen.IdResponsable;

                if (IdTipoDeComprobanteGral == String.Empty)
                {
                    IdTipoDeComprobanteGral = IdTipoDeComprobante;
                }

                //Si el tipo de Comprobante actual es distinto al tipo de comprobante del primer comprobante no hace nada (por ahora)
                if (IdTipoDeComprobante == IdTipoDeComprobanteGral)
                {
                    //Para cada IdComprobante tengo que obtener los ítems
                    //Datos del item del comprobante
                    tpu_ComprobantesDetDataset Items = businessrules.tpu_ComprobantesDet.GetByPk(IdComprobante);

                    foreach (tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow row in Items.tpu_ComprobantesDet)
                    {
                        OrdinalOrigen  = row.Ordinal;
                        CantidadOrigen = row.Cantidad;

                        //Por ahora estoy tomando en CantidadOrigen la cantidad original del item. Luego tengo que hacer aparecer lo que está en tsa_ComprobantesRelacionOrigenDestino
                        IdProducto    = row.IdProducto;
                        Descripcion   = tsh_Productos.GetByPk(row.IdProducto).Descripcion;
                        PrecioDeCosto = row.PrecioDeCosto;
                        IdSucursal    = row.IdSucursal;
                        IdEmpresa     = row.IdEmpresa;
                        RelacionComprobanteDeCompraOrigenDestino ItemOrigen = new RelacionComprobanteDeCompraOrigenDestino(IdComprobante, IdTipoDeComprobante, Numero, OrdinalOrigen, CantidadOrigen, IdProducto, Descripcion, PrecioDeCosto, IdSucursal, IdEmpresa);
                        this.Add(ItemOrigen);
                    }
                }
            }
            //
            // TODO: agregar aquí la lógica del constructor
            //
        }
예제 #6
0
        public static tpu_ComprobantesDetDataset ComprobantesPendientesDet(string IdComprobante, long Ordinal, string IdProducto)
        {
            tpu_ComprobantesDetDataset data = new tpu_ComprobantesDetDataset();
            SqlCommand cmd = new SqlCommand("Pr_tpu_ComprobantesPendientesDet", dbhelper.Connection.GetConnection());

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection.Open();

            cmd.Parameters.Add(new SqlParameter("@IdComprobante", SqlDbType.VarChar));
            if (IdComprobante == "" || IdComprobante == null)
            {
                cmd.Parameters["@IdComprobante"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@IdComprobante"].Value = IdComprobante;
            }

            cmd.Parameters.Add(new SqlParameter("@Ordinal", SqlDbType.BigInt));
            if (Ordinal == long.MinValue)
            {
                cmd.Parameters["@Ordinal"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@Ordinal"].Value = Ordinal;
            }

            cmd.Parameters.Add(new SqlParameter("@IdProducto", SqlDbType.VarChar));
            if (IdProducto == "" || IdProducto == null)
            {
                cmd.Parameters["@IdProducto"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@IdProducto"].Value = IdProducto;
            }


            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.TableMappings.Add("Table", "tpu_ComprobantesDet");
            adapter.SelectCommand = cmd;
            adapter.Fill(data);

            return(data);
        }
예제 #7
0
        public static tpu_ComprobantesDetDataset GetList()
        {
            tpu_ComprobantesDetDataset data = new tpu_ComprobantesDetDataset();

            return(( tpu_ComprobantesDetDataset )GetList(data));
        }
예제 #8
0
 public static void Update(tpu_ComprobantesDetDataset dataSet)
 {
     Update(dataSet.tpu_ComprobantesDet);
 }
예제 #9
0
        public void Commit()
        {
            _dataComprobante                = new tpu_ComprobantesDataset();
            _dataComprobanteDeCompra        = new tpu_ComprobantesDeCompraDataset();
            _dataComprobanteDetalleDeuda    = new tpu_ComprobanteDetalleDeudaDataset();
            _dataComprobantesDet            = new tpu_ComprobantesDetDataset();
            _dataComprobantesDetalleDePagos = new tpu_ComprobanteDetalleDePagosDataset();

            foreach (string _idComprobanteAAnular in _idComprobantesAAnular)
            {
                if (_idComprobanteAAnular != null && _idComprobanteAAnular != string.Empty)
                {
                    tpu_ComprobantesDataset.tpu_ComprobantesRow rowAux = businessrules.tpu_Comprobantes.GetByPk(_idComprobanteAAnular);
                    if (rowAux != null)
                    {
                        string IdTipoDeComprobante = rowAux.IdTipoDeComprobante;
                        if (_tableComprobantesAnulacion.ContainsKey(IdTipoDeComprobante))
                        {
                            string IdTipoDeComprobanteAnula = Convert.ToString(_tableComprobantesAnulacion[IdTipoDeComprobante]);

                            /*tpu_Comprobantes*/
                            tpu_ComprobantesDataset.tpu_ComprobantesRow rowC = mz.erp.businessrules.tpu_Comprobantes.GetByPk(_idComprobanteAAnular);
                            rowC.IdTipoDeComprobante = IdTipoDeComprobanteAnula;
                            _dataComprobante.tpu_Comprobantes.ImportRow((DataRow)rowC);

                            /*tpu_ComprobantesDeCompra*/
                            tpu_ComprobantesDeCompraDataset.tpu_ComprobantesDeCompraRow rowCC = mz.erp.businessrules.tpu_ComprobantesDeCompra.GetByPk(_idComprobanteAAnular);
                            if (rowCC != null)
                            {
                                rowCC["IdTipoDeComprobante"] = IdTipoDeComprobanteAnula;
                                _dataComprobanteDeCompra.tpu_ComprobantesDeCompra.ImportRow(rowCC);
                            }

                            /*tpu_ComprobantesDet*/
//							tpu_ComprobantesDetDataset  dataCD = mz.erp.businessrules.tpu_ComprobantesDet.GetByPk(_idComprobanteAAnular);
//							foreach (DataRow row in dataCD.tpu_ComprobantesDet.Rows)
//							{
//								if (row != null)
//								{
//									row["IdTipoDeComprobante"] = IdTipoDeComprobanteAnula;
//									_dataComprobantesDet.tpu_ComprobantesDet.ImportRow(row);
//								}
//							}



                            /*tpu_ComprobanteDetalleDePagos*/
                            tpu_ComprobanteDetalleDePagosDataset dataCDP = mz.erp.businessrules.tpu_ComprobanteDetalleDePagos.GetList(null, null, _idComprobanteAAnular, null, decimal.MinValue);
                            foreach (DataRow row in dataCDP.tpu_ComprobanteDetalleDePagos.Rows)
                            {
                                if (row != null)
                                {
                                    row["IdTipoDeComprobante"] = IdTipoDeComprobanteAnula;
                                    _dataComprobantesDetalleDePagos.tpu_ComprobanteDetalleDePagos.ImportRow(row);
                                }
                            }


                            /*tpu_ComprobanteDetalleDeuda*/
                            //tpu_ComprobanteDetalleDeudaDataset dataCDD = mz.erp.businessrules.tpu_ComprobanteDetalleDeuda.GetList(_idComprobanteAAnular, null, null);
                            DataSet dataCDD = mz.erp.businessrules.tpu_ComprobanteDetalleDeuda.GetList(_idComprobanteAAnular, null, null);
                            foreach (DataRow row in dataCDD.Tables[0].Rows) //foreach(DataRow row in dataCDD.tpu_ComprobanteDetalleDeuda.Rows)
                            {
                                if (row != null)
                                {
                                    row["IdTipoDeComprobante"] = IdTipoDeComprobanteAnula;
                                    _dataComprobanteDetalleDeuda.tpu_ComprobanteDetalleDeuda.ImportRow(row);
                                }
                            }
                        }
                    }
                }
            }
        }