Пример #1
0
        public void Commit()
        {
            DatasetComprobante = new mz.erp.commontypes.data.tpu_ComprobantesExDataset();
            tpu_ComprobantesExDataset.tpu_ComprobantesRow row = DatasetComprobante.tpu_Comprobantes.Newtpu_ComprobantesRow();

            row.Fecha         = System.DateTime.Now;
            row.FechaCreacion = System.DateTime.Now;
            row.IdComprobante = this.IdComprobante;
            row.IdProveedor   = this.IdProveedor;
            row.IdResponsable = this.IdResponsable;


            row.IdTipoDeComprobante = this.TipoComprobanteDestino;
            row.Numero             = "";//Util.NewStringId();
            row.IdCotizacionCierre = ComprobantesRules.Contabilidad_CotizacionReferencia;
            row.Total = this.Total;

            row.IdConexionCreacion           = Security.IdConexion;
            row.IdConexionUltimaModificacion = Security.IdConexion;

            row.IdEmpresa  = this.IdEmpresa;
            row.IdSucursal = this.IdSucursalDestinoDatos;

            row.IdInstanciaCaja = string.Empty;
            row.IdMonedaCierre  = ComprobantesRules.Contabilidad_MonedaReferencia;
            row.IdReservado     = 0;

            this.Numero = row.Numero;

            DatasetComprobante.tpu_Comprobantes.Addtpu_ComprobantesRow(row);

            this.Items.Commit();
        }
Пример #2
0
        public void Commit()
        {
            tpu_ComprobantesExDataset data = this.ItemsComprobantes.Parent.DatasetComprobante;

            tpu_ComprobantesExDataset.tpu_ComprobantesDetRow row = data.tpu_ComprobantesDet.Newtpu_ComprobantesDetRow();
            row.IdComprobante                = this.ItemsComprobantes.Parent.IdComprobante;
            row.Ordinal                      = this._ordinal;
            row.Cantidad                     = this._cantidad;
            row.IdProducto                   = this._idProducto;
            row.PrecioDeCosto                = this._precioDeCosto;
            row.ImpuestosDirectos            = 0;  //this.ImpuestosDirectos.Total;
            row.ImpuestosIndirectos          = 0;  //this.ImpuestosIndirectos.Total;
            row.IdCotizacionCierre           = ComprobantesRules.Contabilidad_CotizacionReferencia;
            row.IdMonedaCierre               = ComprobantesRules.Contabilidad_MonedaReferencia;
            row.IdMonedaOrigen               = ComprobantesRules.Contabilidad_MonedaReferencia;
            row.FechaCreacion                = System.DateTime.Now;
            row.IdConexionCreacion           = Security.IdConexion;
            row.IdEmpresa                    = Security.IdEmpresa;
            row.IdSucursal                   = Security.IdSucursal;
            row.IdConexionUltimaModificacion = Security.IdConexion;
            data.tpu_ComprobantesDet.Addtpu_ComprobantesDetRow(row);
            //Commit de los movimientos de Stock
            data = (tpu_ComprobantesExDataset)this.CommitMovimientosDeStock(data);
            // Commit de las relaciones origen destino
            data = (tpu_ComprobantesExDataset)this.CommitRelacionOrigenDestino(data);
        }
Пример #3
0
        /*
         * public static void Update(tpu_ComprobantesDataset dataComprobantes, tpu_ComprobantesDetDataset dataComprobantesDet,
         *      tlg_MovimientosDeStockDataset dataMov, tpu_ComprobantesRelacionOrigenDestinoDataset dataRel,
         *      bool ActualizaNumeracion, string IdTransaction, SentenciasReplicacion replicacion)
         * {
         *      string IdVariable;
         *      if (ActualizaNumeracion)
         *      {
         *              IdVariable = UpdateNumero(dataComprobantes,IdTransaction);
         *      }
         *      else
         *      {
         *              IdVariable = dataComprobantes.tpu_Comprobantes.Rows[0]["Numero"].ToString();
         *      }
         *      mz.erp.dataaccess.tpu_ComprobantesEx.Update(dataComprobantes,dataComprobantesDet,dataMov,dataRel,
         *              IdVariable, replicacion,IdTransaction);
         * }
         */
        #endregion

        public static void Update(tpu_ComprobantesExDataset data, bool ActualizaNumeracion, string Momento, long IdSucursalDestino)
        {
            string IdVariable;

            if (ActualizaNumeracion)
            {
                IdVariable = UpdateNumero(data);
            }
            else
            {
                IdVariable = data.tpu_Comprobantes.Rows[0]["Numero"].ToString();
            }
            SentenciasReplicacion replicacion = GenerateReplicaction(Momento, IdSucursalDestino);

            mz.erp.dataaccess.tpu_ComprobantesEx.Update(data, IdVariable, replicacion);
        }
Пример #4
0
        private void FillLoadData(ItemComprobante item, string TipoDeComprobanteDestino, RelacionesComprobanteDeCompraOrigenDestino relaciones)
        {
            //Tomar el XML con lo guardado
            switch (this._state)
            {
            case "NEW":
            {
                DatasetComprobante = new tpu_ComprobantesExDataset();
                try
                {
                    DatasetComprobante.ReadXml(mz.erp.systemframework.Util.ResourcePath() + "/temp/pedido" + Security.IdUsuario + ".xml");
                    FillStaticData("EDIT", item, null, null);
                }
                catch (Exception e)
                {
                    DatasetComprobante = mz.erp.businessrules.tpu_ComprobantesEx.NewDataSet();
                    FillStaticData("NEW", item, null, null);
                }



                break;
            }

            case "STEP":
            {
                this.DatasetComprobante = new mz.erp.commontypes.data.tpu_ComprobantesExDataset();

                this.IdResponsable = relaciones.IdResponsable;


                this.IdProveedor = relaciones.IdProveedor;

                this.TipoComprobanteDestino = TipoDeComprobanteDestino;

                this.FechaComprobante = System.DateTime.Now;
                this.IdComprobante    = Util.NewStringId();

                this.Numero = string.Empty;
                this.Items  = new ItemsComprobantesCompra("STEP", this, relaciones);
                this.Total  = 0;
                break;
                break;
            }
            }
            SetEditablesProperty();
        }
Пример #5
0
        private static string  UpdateNumero(tpu_ComprobantesExDataset data)
        {
            foreach (System.Data.DataRow row1 in data.tpu_Comprobantes.Rows)
            {
                if ((string)row1["Numero"] == "")
                {
                    string numeracion = Variables.GetValueString("Comprobantes.Numeracion." + (string)row1["IdTipoDeComprobante"]);
                    string Numero     = Util.StcZero(numeracion, 8);
                    row1["Numero"] = Numero;
                    sy_VariablesDataset.sy_VariablesRow row = mz.erp.businessrules.sy_Variables.GetByPk("Comprobantes.Numeracion." + row1["IdTipoDeComprobante"]);

                    return(row.IdVariable);
                }
            }

            return(null);
        }
Пример #6
0
        private tpu_ComprobantesExDataset CommitRelacionOrigenDestino(tpu_ComprobantesExDataset data)
        {
            if (!this.ItemsComprobantes.Parent.Momento.Equals("PREPEDIR"))
            {
                string IdComprobanteOrigen  = this._idComprobanteOrigen;
                string IdComprobanteDestino = this.ItemsComprobantes.Parent.IdComprobanteDestino;
                long   IdOrdinalOrigen      = this._ordinalOrigen;
                long   IdOrdinalDestino     = this._ordinal;
                bool   CierraCircuito       = mz.erp.businessrules.tlg_TiposComprobantesOrigenDestino.CierraCircuito(this.ItemsComprobantes.Parent.TipoComprobanteDestino);

                decimal Cantidad = this._cantidad;
                if (IdComprobanteOrigen != IdComprobanteDestino)
                {
                    data = mz.erp.businessrules.tpu_ComprobantesEx.SetRelacionOrigenDestino(data, IdComprobanteOrigen, IdComprobanteDestino, IdOrdinalOrigen, IdOrdinalDestino, Cantidad, CierraCircuito);
                }
            }
            return(data);
        }
Пример #7
0
        private tpu_ComprobantesExDataset CommitMovimientosDeStock(tpu_ComprobantesExDataset data)
        {
            //Movimiento de Stock
            if (!this.ItemsComprobantes.Parent.Momento.Equals("PREPEDIR"))
            {
                string IdDeposito = ComprobantesRules.Momentos_Parametros(this.ItemsComprobantes.Parent.Momento, "Deposito");
                string IdSeccion  = ComprobantesRules.Momentos_Parametros(this.ItemsComprobantes.Parent.Momento, "Seccion");

                string IdEstadoStockOrigen  = string.Empty;
                string IdEstadoStockDestino = string.Empty;
                long   idMomentoDeStock     = tlg_TiposComprobantesOrigenDestino.GetMomento(this._idTipoComprobanteOrigen, this.ItemsComprobantes.Parent.TipoComprobanteDestino);
                //Stock.GetEstados( idMomentoDeStock, ref IdEstadoStockOrigen, ref IdEstadoStockDestino );

                if ((IdDeposito != string.Empty) && (IdSeccion != string.Empty))
                {
                    data = mz.erp.businessrules.tpu_ComprobantesEx.SetMovimientosDeStock(data, Security.IdSucursal, Security.IdEmpresa, IdDeposito, IdSeccion, null, IdEstadoStockOrigen, IdEstadoStockDestino, null, this._idProducto, this._cantidad);
                }
            }
            return(data);
        }
Пример #8
0
        private void FillLoadData(string IdComprobante, string state, string TipoComprobanteDestino, string IdResponsable, string idCuenta, string idCondicionDeVenta, RelacionesComprobanteOrigenDestino relaciones)
        {
            switch (state)
            {
            case "STEP":
            {
                this.DatasetComprobante = new mz.erp.commontypes.data.tpu_ComprobantesExDataset();

                this.IdResponsable = relaciones.IdResponsable;
                //this.VariablesComprobante = new VariablesAuxiliares( "NEW", this );

                //this.Cuenta = new Cuenta( "EDIT", this, relaciones.IdCuenta );
                //this.IdCuenta = relaciones.IdCuenta;

                this.TipoComprobanteDestino = TipoComprobanteDestino;

                this.FechaComprobante = System.DateTime.Now;
                this.IdComprobante    = Util.NewStringId();

                this.Numero = string.Empty;
                //this.TemporalNumeration = true;



                //this.Items = new ItemsComprobantes("STEP", this, relaciones);
                //this.Items.IsDirty=false;

                //this.CondicionDeVenta = new CondicionDeVenta( "NEW", this, idCondicionDeVenta );
                //long condicionPorDefecto = ComprobantesRules.Momentos_FormaDePago_Default(this.Momento);
                //if ( ! (condicionPorDefecto == long.MinValue))
                //	this.CondicionDeVenta.IdCondicionDeVenta = Convert.ToString(condicionPorDefecto);

                this.Total = 0;
                break;
            }

            case "EDIT":
            {
                this.DatasetComprobante = mz.erp.businessrules.tpu_ComprobantesEx.GetList(IdComprobante);
                tpu_ComprobantesExDataset.tpu_ComprobantesRow rowComprobante = (tpu_ComprobantesExDataset.tpu_ComprobantesRow) this.DatasetComprobante.tpu_Comprobantes.Rows[0];
                this.IdResponsable = rowComprobante.IdResponsable;


                this.TipoComprobanteDestino = rowComprobante.IdTipoDeComprobante;
                this.FechaComprobante       = rowComprobante.Fecha;
                this.IdComprobante          = rowComprobante.IdComprobante;
                this.Numero = rowComprobante.Numero;
                //this.TemporalNumeration = false;


                //this.VariablesComprobante = new VariablesAuxiliares( "EDIT", this );
                //this.Cuenta = new Cuenta( "EDIT", this, rowComprobante.IdCuenta );
                //this.IdCuenta = rowComprobante.IdCuenta;



                //this.Items = new ItemsComprobantes("EDIT", this );
                //this.Items.IsDirty=false;

                //this.CondicionDeVenta = new CondicionDeVenta("EDIT", this );
                this.Total = rowComprobante.Total;
                break;
            }

            case "NEW":
            {
                this.DatasetComprobante = new mz.erp.commontypes.data.tpu_ComprobantesExDataset();
                //Modificar para tomar el responsable por defecto

                this.IdResponsable = IdResponsable;


                //this.Cuenta = new Cuenta( "NEW", this, idCuenta);
                //this.IdCuenta = idCuenta;

                //this.TipoComprobanteDestino = Cuenta.ComprobanteDeVentaSugerido();

                this.FechaComprobante = System.DateTime.Now;
                this.IdComprobante    = Util.NewStringId();

                this.Numero = string.Empty;
                //this.TemporalNumeration = true;


                //this.VariablesComprobante = new VariablesAuxiliares( "NEW", this );

                //this.Items = new ItemsComprobantes( "NEW", this );
                //this.Items.IsDirty=false;

                /*this.CondicionDeVenta = new CondicionDeVenta( "NEW", this, idCondicionDeVenta );
                 * long condicionPorDefecto = ComprobantesRules.Momentos_FormaDePago_Default(this.Momento);
                 * if ( ! (condicionPorDefecto == long.MinValue))
                 *      this.CondicionDeVenta.IdCondicionDeVenta = Convert.ToString(condicionPorDefecto);*/
                this.Total = 0;

                break;
            }
            }

            //InitEvents();
        }
Пример #9
0
 public static void Update(tpu_ComprobantesExDataset data, bool ActualizaNumeracion)
 {
     Update(data, ActualizaNumeracion, string.Empty, long.MinValue);
 }