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(); }
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(); }
private void FillStaticData(string Action, ItemComprobante item, string idTipoDeComprobanteDestino, RelacionesComprobanteDeCompraOrigenDestino relaciones) { switch (Action.ToUpper()) { case "NEW": { this.IdComprobante = mz.erp.systemframework.Util.NewStringId(); this.IdResponsable = Security.IdPersona; this.IdProveedor = Variables.GetValueString("Compras.Pedidos.ProveedorPorDefault"); this.FechaComprobante = DateTime.Now; this._itemsComprobantesCompras = new ItemsComprobantesCompra("New", this); //this.IdComprobanteDestino = "CPE"; this._tipoComprobanteDestino = "CPE"; //this.TipoComprobanteDestino = mz.erp.businessrules.tsy_TiposDeComprobantes.GetByPk(this.IdComprobanteDestino).Descripcion; if (item != null) { ItemComprobanteCompra itemCompra = new ItemComprobanteCompra(item, this._itemsComprobantesCompras); this._itemsComprobantesCompras.Add(itemCompra); } break; } case "EDIT": { tpu_ComprobantesExDataset.tpu_ComprobantesDataTable tableComp = this.DatasetComprobante.tpu_Comprobantes; tpu_ComprobantesExDataset.tpu_ComprobantesRow rowComp = (tpu_ComprobantesExDataset.tpu_ComprobantesRow)tableComp.Rows[0]; this.IdComprobante = rowComp.IdComprobante; this.IdComprobanteDestino = rowComp.IdComprobante; this.IdResponsable = rowComp.IdResponsable; this.FechaComprobante = rowComp.Fecha; this.TipoComprobanteDestino = rowComp.IdTipoDeComprobante; this.IdProveedor = rowComp.IdProveedor; this.Total = rowComp.Total; this._itemsComprobantesCompras = new ItemsComprobantesCompra("New", this); ItemComprobanteCompra itemCompra; tpu_ComprobantesExDataset.tpu_ComprobantesDetDataTable tableDet = this.DatasetComprobante.tpu_ComprobantesDet; foreach (tpu_ComprobantesExDataset.tpu_ComprobantesDetRow rowDet in tableDet.Rows) { itemCompra = new ItemComprobanteCompra(rowDet, this._itemsComprobantesCompras); this._itemsComprobantesCompras.Add(itemCompra); } if (item != null) { if (!this._itemsComprobantesCompras.Contains(item)) { itemCompra = new ItemComprobanteCompra(item, this._itemsComprobantesCompras); this._itemsComprobantesCompras.Add(itemCompra); } } break; } } }