Пример #1
0
        /// <summary>
        /// Fuerza la escritura de los datos en memoria al dataset del comprobante para poder ser enviados a almacenar en el RDBM
        /// </summary>
        /// El parametro process es necesario solo cuando se debe actualizar la tabla tsa_Cuentas pq el comprobante afecta la cta cte.. Si no necesita hacerlo el parametro puede ser null.
        public void Commit(Process process)
        {
            if (DetalleCondicionDeVenta.Count > 0)
            {
                tsa_ComprobantesExDataset comprobante = this.Comprobante.DatasetComprobante;
                string  IdComprobante     = this.Comprobante.IdComprobante;
                string  IdTipoComprobante = this.Comprobante.TipoComprobanteDestino;
                string  Numero            = this.Comprobante.Numero;
                int     signo             = (int)tsy_TiposDeComprobantes.GetByPk(IdTipoComprobante).signo;
                decimal importe           = 0;

                foreach (DetalleCuotas dc in this.DetalleCondicionDeVenta)
                {
                    tsa_ComprobantesExDataset.tsa_ComprobanteDetalleDeudaRow row = comprobante.tsa_ComprobanteDetalleDeuda.Newtsa_ComprobanteDetalleDeudaRow();
                    row.IdComprobante       = IdComprobante;
                    row.IdTipoDeComprobante = IdTipoComprobante;
                    row.Numero             = Numero;
                    row.FechaEmision       = mz.erp.systemframework.Util.AddTime(this.Comprobante.FechaComprobante, mz.erp.businessrules.Sistema.DateTime.Now);
                    row.Cuota              = Convert.ToInt16(dc.GetIdCuota());
                    row.FechaVencimiento   = dc.GetFechaVencimiento();
                    row.Importe            = dc.GetMonto() * signo;
                    row.Saldo              = dc.GetMonto() * signo;
                    row.IdMonedaCierre     = Variables.GetValueString("Contabilidad.MonedaReferencia");
                    row.IdCotizacionCierre = Variables.GetValueString("Contabilidad.CotizacionReferencia");
                    row.IdSucursal         = Security.IdSucursal;
                    row.IdEmpresa          = Security.IdEmpresa;
                    comprobante.tsa_ComprobanteDetalleDeuda.Rows.Add(row);
                    importe = importe + row.Importe;
                }
                string IdCuenta = this.Comprobante.IdCuenta;
                GuardarSaldoCuentaCorriente.GetInstance().CommitSaldoCuentaCorriente(process, IdCuenta, importe, IdTipoComprobante);
            }
        }
 public static GuardarSaldoCuentaCorriente GetInstance()
 {
     if (instance == null)
     {
         instance = new GuardarSaldoCuentaCorriente();
     }
     return(instance);
 }
Пример #3
0
        public void Flush(string IdTransaction)
        {
            if (OnTaskBeforeFlush != null)
            {
                OnTaskBeforeFlush(this, new EventArgs());
            }
            string IdVariable = UpdateNumero(this._dataComprobantes.Tables[0].Rows[0], IdTransaction);

            _replication = GenerateReplication();
            mz.erp.dataaccess.tsa_Comprobantes.Update(_dataComprobantes.Tables["tsa_Comprobantes"], IdTransaction, _replication);
            this.IdComprobante = (string)_dataComprobantes.Tables["tsa_Comprobantes"].Rows[0]["IdComprobante"];
            mz.erp.dataaccess.sy_Variables.Update(IdVariable, (string)_dataComprobantes.Tables["tsa_Comprobantes"].Rows[0]["Numero"], IdTransaction);
            foreach (DataRow row in _dataComprobantesDetalleDeuda.Tables[0].Rows)
            {
                row["IdComprobante"] = this.IdComprobante;
                //German 20120222 -  Tarea 0000247
                if (_processManager.Process.ProcessName.Equals("ProcesoPrevenderVenderAcopio") ||
                    this._processManager.Process.ProcessName.Equals("ProcesoPreprestarPrestarAcopio"))
                {
                    row["Saldo"] = 0;
                }
                //German 20120222 -  Tarea 0000247
            }
            mz.erp.dataaccess.tsa_ComprobanteDetalleDeuda.Update(_dataComprobantesDetalleDeuda.Tables["tsa_ComprobanteDetalleDeuda"], IdTransaction, _replication);
            //German 20120222 -  Tarea 0000247
            foreach (DataRow row in _dataAplicacionPagos.Tables[0].Rows)
            {
                row["IdComprobanteDestino"] = this.IdComprobante;
            }
            mz.erp.dataaccess.tsa_AplicacionPagos.Update(_dataAplicacionPagos.Tables[0], IdTransaction);
            //German 20120222 -  Tarea 0000247
            GuardarSaldoCuentaCorriente.GetInstance().FlushSaldoCuentaCorriente(this.GetProcessManagerParent().Process, IdTransaction, _replication);

            if (OnTaskAfterFlush != null)
            {
                OnTaskAfterFlush(this, new EventArgs());
            }
        }
Пример #4
0
        private void CommitComprobanteDetalleDeuda()
        {
            tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row = ((tsa_ComprobanteDetalleDeudaDataset)_dataComprobantesDetalleDeuda).tsa_ComprobanteDetalleDeuda.Newtsa_ComprobanteDetalleDeudaRow();
            row.IdComprobante       = mz.erp.systemframework.Util.NewStringId();
            row.IdTipoDeComprobante = this.TipoComprobanteDestino;
            row.Numero             = this.Numero;
            row.FechaEmision       = mz.erp.systemframework.Util.AddTime(this.FechaComprobante, mz.erp.businessrules.Sistema.DateTime.Now);
            row.Cuota              = 1;
            row.FechaVencimiento   = row.FechaEmision;
            row.Importe            = this._total * this._signoCuentaCorriente;
            row.Saldo              = this._total * this._signoCuentaCorriente;
            row.IdMonedaCierre     = Variables.GetValueString("Contabilidad.MonedaReferencia");
            row.IdCotizacionCierre = Variables.GetValueString("Contabilidad.CotizacionReferencia");
            row.IdSucursal         = Security.IdSucursal;
            row.IdEmpresa          = Security.IdEmpresa;
            ((tsa_ComprobanteDetalleDeudaDataset)_dataComprobantesDetalleDeuda).tsa_ComprobanteDetalleDeuda.Rows.Add(row);

            string  IdCuenta            = this._cuenta.IdCuenta;
            decimal Importe             = row.Importe;
            string  IdTipoDeComprobante = this.TipoComprobanteDestino;

            GuardarSaldoCuentaCorriente.GetInstance().CommitSaldoCuentaCorriente(this.GetProcessManagerParent().Process, IdCuenta, Importe, IdTipoDeComprobante);
        }