private void btnImportarNC_Click(object sender, EventArgs e) { RecibocajaingresoImpNotaCreditoFrm recibocajaingresoImpNotaCreditoFrm = new RecibocajaingresoImpNotaCreditoFrm(IdCpVentaSel); if (recibocajaingresoImpNotaCreditoFrm.ShowDialog() == DialogResult.OK) { if (recibocajaingresoImpNotaCreditoFrm.VwNotacreditoclireciboingresoimp != null) { rNumeroNc.EditValue = string.Format( "{0}-{1}", recibocajaingresoImpNotaCreditoFrm.VwNotacreditoclireciboingresoimp.Serienotacredito, recibocajaingresoImpNotaCreditoFrm.VwNotacreditoclireciboingresoimp.Numeronotacredito); rFechaNc.EditValue = recibocajaingresoImpNotaCreditoFrm.VwNotacreditoclireciboingresoimp.Fechaemision; nTotalNotaCredito.EditValue = recibocajaingresoImpNotaCreditoFrm.VwNotacreditoclireciboingresoimp.Saldoaimportar; iIdnotacreditocli.EditValue = recibocajaingresoImpNotaCreditoFrm.VwNotacreditoclireciboingresoimp.Idnotacreditocli; VwRecibocajaingresodet vwRecibocajaingresodet = VwRecibocajaingresodetList.FirstOrDefault(x => x.Idmediopago == 9); if (vwRecibocajaingresodet != null) { vwRecibocajaingresodet.Idnotacreditocli = (int?)iIdnotacreditocli.EditValue; vwRecibocajaingresodet.Importenc = (decimal)nTotalNotaCredito.EditValue; gvMedioPago.RefreshData(); } SumarMedioPago(); } } }
public RecibocajaingresoimprevistoMntItemFrm(TipoMantenimiento tipoMnt, VwRecibocajaingresodet vwRecibocajadetRef, VwRecibocajaingresoimprevisto vwRecibocajaimprevistosMnt) { InitializeComponent(); _errorProvider = new DXErrorProvider(); var styleController = new StyleController(); WinFormUtils.SetStyleController(this, styleController); TipoMnt = tipoMnt; VwRecibocajadetRef = vwRecibocajadetRef; VwRecibocajaimprevistosMnt = vwRecibocajaimprevistosMnt; }
private void CargarDetalleImprevistos() { VwRecibocajaingresodet recibocajadet = (VwRecibocajaingresodet)gvDetalle.GetFocusedRow(); if (recibocajadet != null) { string condicion = string.Format("idrecibocajaingresodet ={0}", recibocajadet.Idrecibocajaingresodet); const string orden = "idrecibocajaingresoimprevisto"; VwRecibocajaimprevistosList = Service.GetAllVwRecibocajaingresoimprevisto(condicion, orden); gcImprevistoDet.DataSource = VwRecibocajaimprevistosList; gvImprevistoDet.BestFitColumns(); } }
public CajaCobroMedioPagoOrdenVentaMntItemFrm(TipoMantenimiento tipoMnt, VwRecibocajaingresodet vwRecibocajadet, VwTipocp vwTipoCpVenta, List <VwRecibocajaingresodet> vwRecibocajaingresodetListMnt) { InitializeComponent(); _errorProvider = new DXErrorProvider(); var styleController = new StyleController(); WinFormUtils.SetStyleController(this, styleController); TipoMnt = tipoMnt; VwRecibocajadetMnt = vwRecibocajadet; VwTipoCpVenta = vwTipoCpVenta; VwRecibocajaingresodetListMnt = vwRecibocajaingresodetListMnt; }
private void AgregarItemMedioPagoEfectivo() { VwRecibocajaingresodet vwRecibocajaingresodet = new VwRecibocajaingresodet(); vwRecibocajaingresodet.Numeroitem = 1; vwRecibocajaingresodet.Idtipodocmov = 1; //CpVenta vwRecibocajaingresodet.Idtipocp = VwCpventa.Idtipocp; vwRecibocajaingresodet.Serietipocp = VwCpventa.Seriecpventa; vwRecibocajaingresodet.Numerotipocp = VwCpventa.Numerocpventa; vwRecibocajaingresodet.Importepago = (decimal)nTotaldocumento.EditValue; vwRecibocajaingresodet.Idmediopago = 9; // MedioPago: Efectivo vwRecibocajaingresodet.Nombremediopago = "EFECTIVO, EN LOS DEMAS CASOS"; vwRecibocajaingresodet.Numeromediopago = string.Empty; vwRecibocajaingresodet.Comentario = string.Empty; VwRecibocajaingresodetList.Add(vwRecibocajaingresodet); SumarMedioPago(); }
private Recibocajaingresodet AsignarRecibocajaDetalle(VwRecibocajaingresodet vwRecibocajadet) { Recibocajaingresodet recibocajadetMnt = new Recibocajaingresodet { Idrecibocajaingreso = IdEntidadMnt, Idrecibocajaingresodet = vwRecibocajadet.Idrecibocajaingresodet, Numeroitem = vwRecibocajadet.Numeroitem, Importepago = vwRecibocajadet.Importepago, Idmediopago = vwRecibocajadet.Idmediopago, Numeromediopago = vwRecibocajadet.Numeromediopago, Comentario = vwRecibocajadet.Comentario, Idcpventa = vwRecibocajadet.Idcpventa, Idnotacreditocli = vwRecibocajadet.Idnotacreditocli, Importenc = vwRecibocajadet.Importenc }; return(recibocajadetMnt); }
private void bmMedioDePago_ItemClick(object sender, ItemClickEventArgs e) { var subMenu = e.Item as BarSubItem; if (subMenu != null) { return; } var idTipoCpSel = VwCpventa.Idtipocp; if (idTipoCpSel == null) { return; } if (VwCpventa != null) { CajaCobroMedioPagoCpVentaMntItemFrm cajaCobroMedioPagoMntItemFrm; VwRecibocajaingresodet vwRecibocajaingresodetMnt; switch (e.Item.Name) { case "btnAddMedioPago": vwRecibocajaingresodetMnt = new VwRecibocajaingresodet(); //Asignar el siguiente item var sgtItem = VwRecibocajaingresodetList.Where(w => w.DataEntityState != DataEntityState.Deleted) .OrderByDescending(t => t.Numeroitem) .FirstOrDefault(); vwRecibocajaingresodetMnt.Numeroitem = sgtItem == null ? 1 : sgtItem.Numeroitem + 1; vwRecibocajaingresodetMnt.ImportePendiente = (decimal)nPendiente.EditValue; cajaCobroMedioPagoMntItemFrm = new CajaCobroMedioPagoCpVentaMntItemFrm(TipoMantenimiento.Nuevo, vwRecibocajaingresodetMnt, VwCpventa, VwRecibocajaingresodetList); if (cajaCobroMedioPagoMntItemFrm.ShowDialog() == DialogResult.OK) { VwRecibocajaingresodetList.Add(vwRecibocajaingresodetMnt); } SumarMedioPago(); if (!gvMedioPago.IsLastRow) { gvMedioPago.MoveLastVisible(); gvMedioPago.Focus(); gvMedioPago.FocusedColumn = gvMedioPago.Columns["Importepago"]; } break; case "btnEditMedioPago": if (gvMedioPago.RowCount == 0) { break; } vwRecibocajaingresodetMnt = (VwRecibocajaingresodet)gvMedioPago.GetFocusedRow(); cajaCobroMedioPagoMntItemFrm = new CajaCobroMedioPagoCpVentaMntItemFrm(TipoMantenimiento.Modificar, vwRecibocajaingresodetMnt, VwCpventa, VwRecibocajaingresodetList); cajaCobroMedioPagoMntItemFrm.ShowDialog(); if (cajaCobroMedioPagoMntItemFrm.DialogResult == DialogResult.OK) { SumarMedioPago(); } break; case "btnDelMedioPago": if (gvMedioPago.RowCount == 0) { break; } if (DialogResult.Yes == XtraMessageBox.Show("¿Desea eliminar el item seleccionado?", "Eliminar item", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)) { vwRecibocajaingresodetMnt = (VwRecibocajaingresodet)gvMedioPago.GetFocusedRow(); vwRecibocajaingresodetMnt.DataEntityState = DataEntityState.Deleted; if (!gvMedioPago.IsFirstRow) { gvMedioPago.MovePrev(); } SumarMedioPago(); } break; } } }
private void bmItemsDetalle_ItemClick(object sender, ItemClickEventArgs e) { var subMenu = e.Item as BarSubItem; if (subMenu != null) { return; } TipoMantenimiento tipoMantenimientoItem; RecibocajaingresoMntItemFrm recibocajaMntItemFrm; VwRecibocajaingresodet vwRecibocajadetMnt = new VwRecibocajaingresodet(); Recibocajaingresodet recibocajadet; const string nombreIdDetalle = "Idrecibocajaingresodet"; ParametrosSocioNegocio.Idsocionegocio = (int)iIdsocionegocio.EditValue; switch (e.Item.Name) { case "btnAddItem": if (IdEntidadMnt == 0) { XtraMessageBox.Show("Grabe la información", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } tipoMantenimientoItem = TipoMantenimiento.Nuevo; vwRecibocajadetMnt.Numeroitem = VwRecibocajadetList.Count + 1; recibocajaMntItemFrm = new RecibocajaingresoMntItemFrm(tipoMantenimientoItem, vwRecibocajadetMnt); recibocajaMntItemFrm.ShowDialog(); if (recibocajaMntItemFrm.DialogResult == DialogResult.OK) { recibocajadet = AsignarRecibocajaDetalle(vwRecibocajadetMnt); int idrecibocajadet = Service.SaveRecibocajaingresodet(recibocajadet); if (idrecibocajadet > 0) { vwRecibocajadetMnt.Idrecibocajaingresodet = idrecibocajadet; VwRecibocajadetList.Add(vwRecibocajadetMnt); //Enfocar el id generado if (idrecibocajadet > 0) { gvDetalle.BeginUpdate(); CargarDetalle(); var rowHandle = gvDetalle.LocateByValue(nombreIdDetalle, idrecibocajadet); if (rowHandle == GridControl.InvalidRowHandle) { gvDetalle.EndUpdate(); return; } gvDetalle.EndUpdate(); gvDetalle.FocusedRowHandle = rowHandle; } gvDetalle.RefreshData(); gvDetalle.BestFitColumns(true); } CargarDetalleImprevistos(); SumarTotales(true); } break; case "btnEditDato": tipoMantenimientoItem = TipoMantenimiento.Modificar; vwRecibocajadetMnt = (VwRecibocajaingresodet)gvDetalle.GetFocusedRow(); if (vwRecibocajadetMnt == null) { break; } recibocajaMntItemFrm = new RecibocajaingresoMntItemFrm(tipoMantenimientoItem, vwRecibocajadetMnt); recibocajaMntItemFrm.ShowDialog(); if (recibocajaMntItemFrm.DialogResult == DialogResult.OK) { recibocajadet = AsignarRecibocajaDetalle(vwRecibocajadetMnt); Service.UpdateRecibocajaingresodet(recibocajadet); gvDetalle.RefreshData(); SumarTotales(true); } break; case "btnDelItem": int idRecibpcajadetSel = Convert.ToInt32(gvDetalle.GetRowCellValue(gvDetalle.FocusedRowHandle, nombreIdDetalle)); if (idRecibpcajadetSel > 0) { int cantidadRefImprevistos = VwRecibocajaimprevistosList.Count(x => x.Idrecibocajaingresodet == idRecibpcajadetSel); if (cantidadRefImprevistos > 0) { XtraMessageBox.Show("No puede eliminar tiene referencia en Pagos Relacionados al Documento.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (DialogResult.Yes == XtraMessageBox.Show("¿Desea eliminar el item seleccionado?", "Eliminar Detalle", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)) { VwRecibocajaingresodet vwRecibocajadet = (VwRecibocajaingresodet)gvDetalle.GetFocusedRow(); if (VwRecibocajadetList.Remove(vwRecibocajadet)) { Service.DeleteRecibocajaingresodet(idRecibpcajadetSel); gvDetalle.RefreshData(); if (!gvDetalle.IsFirstRow) { gvDetalle.MovePrev(); } SumarTotales(true); } } } break; } }
public bool Guardar() { if (!Validaciones()) { return(false); } RecibocajaMnt.Idsucursal = (int)iIdsucursal.EditValue; RecibocajaMnt.Idtipocp = (int)iIdtipocp.EditValue; RecibocajaMnt.Idcptooperacion = (int)iIdcptooperacion.EditValue; RecibocajaMnt.Serierecibo = rSerierecibo.Text.Trim(); RecibocajaMnt.Numerorecibo = rNumerorecibo.Text.Trim(); RecibocajaMnt.Idempleado = (int)iIdempleado.EditValue; RecibocajaMnt.Idsocionegocio = (int)iIdsocionegocio.EditValue; RecibocajaMnt.Fecharecibo = (DateTime)iFecharecibo.EditValue; RecibocajaMnt.Fechapago = (DateTime)iFechapago.EditValue; RecibocajaMnt.Anulado = (bool)iAnulado.EditValue; RecibocajaMnt.Fechaanulado = (DateTime?)iFechaanulado.EditValue; RecibocajaMnt.Tipocambio = (decimal)iTipocambio.EditValue; RecibocajaMnt.Idtipomoneda = (int)iIdtipomoneda.EditValue; RecibocajaMnt.Comentario = iComentario.Text.Trim(); RecibocajaMnt.Idtiporecibo = (int)iIdtiporecibo.EditValue; RecibocajaMnt.Totaldocumento = (decimal)rTotaldocumento.EditValue; switch (TipoMnt) { case TipoMantenimiento.Nuevo: //RecibocajaMnt.Createdby = IdUsuario; //RecibocajaMnt.Creationdate = DateTime.Now; break; case TipoMantenimiento.Modificar: //RecibocajaMnt.Modifiedby = IdUsuario; //RecibocajaMnt.Lastmodified = DateTime.Now; break; } try { Cursor = Cursors.WaitCursor; switch (TipoMnt) { case TipoMantenimiento.Nuevo: IdEntidadMnt = Service.SaveRecibocajaingreso(RecibocajaMnt); RecibocajaMnt.Idrecibocajaingreso = IdEntidadMnt; pkIdEntidad.EditValue = IdEntidadMnt; if (IdEntidadMnt > 0 && TipoCpMnt.Numeracionauto && Service.ActualizarCorrelativo((int)iIdtipocp.EditValue, Convert.ToInt32(rNumerorecibo.EditValue))) { iIdtipocp.ReadOnly = true; iIdcptooperacion.ReadOnly = true; } if (IdcpventaCita > 0) { VwCpventa vwCpventa = Service.GetVwCpventa(IdcpventaCita); if (vwCpventa != null) { VwRecibocajaingresodet vwRecibocajaingresodet = new VwRecibocajaingresodet(); vwRecibocajaingresodet.Numeroitem = 1; vwRecibocajaingresodet.Idtipodocmov = vwCpventa.Idtipodocmov; vwRecibocajaingresodet.Idtipocp = vwCpventa.Idtipocp; vwRecibocajaingresodet.Serietipocp = vwCpventa.Seriecpventa; vwRecibocajaingresodet.Numerotipocp = vwCpventa.Numerocpventa; vwRecibocajaingresodet.Importepago = vwCpventa.Importetotal; vwRecibocajaingresodet.Idmediopago = 9; //Efectivo vwRecibocajaingresodet.Numeromediopago = string.Empty; vwRecibocajaingresodet.Comentario = string.Empty; vwRecibocajaingresodet.Idcpventa = IdcpventaCita; Recibocajaingresodet recibocajadet = AsignarRecibocajaDetalle(vwRecibocajaingresodet); int idrecibocajadet = Service.SaveRecibocajaingresodet(recibocajadet); if (idrecibocajadet > 0) { //vwRecibocajaingresodet.Idrecibocajaingresodet = idrecibocajadet; //VwRecibocajadetList.Add(vwRecibocajaingresodet); //Enfocar el id generado if (idrecibocajadet > 0) { CargarDetalle(); var rowHandle = gvDetalle.LocateByValue("Idrecibocajaingresodet", idrecibocajadet); if (rowHandle != GridControl.InvalidRowHandle) { gvDetalle.FocusedRowHandle = rowHandle; } } gvDetalle.RefreshData(); gvDetalle.BestFitColumns(true); } CargarDetalleImprevistos(); SumarTotales(true); } } break; case TipoMantenimiento.Modificar: Service.UpdateRecibocajaingreso(RecibocajaMnt); if (RecibocajaMnt.Anulado) { // Service.AnularReferenciaEntradaOrdenCompraDet(RecibocajaMnt.Idrecibocaja); } break; } if (IdEntidadMnt > 0) { RegistrarValoresPorDefecto(); } var numeroDoc = string.Format("{0} {1}-{2}", iIdtipocp.Text.Trim(), rSerierecibo.Text.Trim(), rNumerorecibo.Text.Trim()); Cursor = Cursors.Default; XtraMessageBox.Show("Se guardo correctamente el documento " + numeroDoc, "Atención", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { Cursor = Cursors.Default; throw; } return(true); }
private void bmUbicaciones_ItemClick(object sender, ItemClickEventArgs e) { var subMenu = e.Item as BarSubItem; if (subMenu != null) { return; } TipoMantenimiento tipoMantenimientoItem; RecibocajaingresoimprevistoMntItemFrm recibocajaimprevistosMntItemFrm; const string nombreidrecibocajaimprevito = "Idrecibocajaingresoimprevisto"; VwRecibocajaingresodet vwRecibocajadetRef = (VwRecibocajaingresodet)gvDetalle.GetFocusedRow(); VwRecibocajaingresoimprevisto vwRecibocajaimprevistosMnt; if (vwRecibocajadetRef == null) { return; } switch (e.Item.Name) { case "cmdAddImprevisto": tipoMantenimientoItem = TipoMantenimiento.Nuevo; vwRecibocajaimprevistosMnt = new VwRecibocajaingresoimprevisto(); recibocajaimprevistosMntItemFrm = new RecibocajaingresoimprevistoMntItemFrm(tipoMantenimientoItem, vwRecibocajadetRef, vwRecibocajaimprevistosMnt); recibocajaimprevistosMntItemFrm.ShowDialog(); if (recibocajaimprevistosMntItemFrm.DialogResult == DialogResult.OK) { Recibocajaingresoimprevisto recibocajaimprevistos = AsignarRecibocajaimprevisto(vwRecibocajaimprevistosMnt); int idrecibocajaimprevisto = Service.SaveRecibocajaingresoimprevisto(recibocajaimprevistos); if (idrecibocajaimprevisto > 0) { vwRecibocajaimprevistosMnt.Idrecibocajaingresoimprevisto = idrecibocajaimprevisto; } VwRecibocajaimprevistosList.Add(vwRecibocajaimprevistosMnt); gvImprevistoDet.RefreshData(); //Enfocar el id generado if (idrecibocajaimprevisto > 0) { gvImprevistoDet.BeginUpdate(); var rowHandle = gvImprevistoDet.LocateByValue(nombreidrecibocajaimprevito, idrecibocajaimprevisto); if (rowHandle == GridControl.InvalidRowHandle) { gvImprevistoDet.EndUpdate(); return; } gvImprevistoDet.EndUpdate(); gvImprevistoDet.FocusedRowHandle = rowHandle; } //CargarDetalleImprevistos(); SumarTotales(true); } break; case "cmdEditImprevisto": if (gvImprevistoDet.RowCount <= 0) { return; } tipoMantenimientoItem = TipoMantenimiento.Modificar; vwRecibocajaimprevistosMnt = (VwRecibocajaingresoimprevisto)gvImprevistoDet.GetFocusedRow(); recibocajaimprevistosMntItemFrm = new RecibocajaingresoimprevistoMntItemFrm(tipoMantenimientoItem, vwRecibocajadetRef, vwRecibocajaimprevistosMnt); recibocajaimprevistosMntItemFrm.ShowDialog(); if (recibocajaimprevistosMntItemFrm.DialogResult == DialogResult.OK) { Recibocajaingresoimprevisto recibocajaimprevistos = AsignarRecibocajaimprevisto(vwRecibocajaimprevistosMnt); Service.UpdateRecibocajaingresoimprevisto(recibocajaimprevistos); gvImprevistoDet.RefreshData(); } //CargarDetalleImprevistos(); SumarTotales(true); break; case "cmdDelImprevisto": int idrecibocajaimprevistoSel = Convert.ToInt32(gvImprevistoDet.GetRowCellValue(gvImprevistoDet.FocusedRowHandle, nombreidrecibocajaimprevito)); if (idrecibocajaimprevistoSel > 0) { if (DialogResult.Yes == XtraMessageBox.Show("¿Desea eliminar el item seleccionado?", "Eliminar producto", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)) { VwRecibocajaingresoimprevisto vwRecibocajaimprevistosSel = (VwRecibocajaingresoimprevisto)gvImprevistoDet.GetFocusedRow(); if (VwRecibocajaimprevistosList.Remove(vwRecibocajaimprevistosSel)) { Service.DeleteRecibocajaingresoimprevisto(idrecibocajaimprevistoSel); gvImprevistoDet.RefreshData(); SumarTotales(true); } } } break; } }
private void bmMntItems_ItemClick(object sender, ItemClickEventArgs e) { var subMenu = e.Item as BarSubItem; if (subMenu != null) { return; } switch (e.Item.Name) { case "btnImportar": if (!Validaciones()) { return; } var maxItem = VwRecibocajadetList.Where(w => w.DataEntityState != DataEntityState.Deleted) .OrderByDescending(t => t.Numeroitem) .FirstOrDefault(); var sgtItem = maxItem == null ? 1 : maxItem.Numeroitem + 1; foreach (var item in _vwCtacteclienteList.Where(x => x.Itemseleccionado)) { VwRecibocajaingresodet vwRecibocajadet = new VwRecibocajaingresodet(); vwRecibocajadet.Numeroitem = sgtItem; vwRecibocajadet.Idtipodocmov = item.Idtipodocmov; vwRecibocajadet.Idtipocp = item.Idtipocp; vwRecibocajadet.Serietipocp = item.Serietipocp; vwRecibocajadet.Numerotipocp = item.Numerotipocp; vwRecibocajadet.Importepago = item.Saldoaimportar; vwRecibocajadet.Idmediopago = 9; vwRecibocajadet.Numeromediopago = ""; vwRecibocajadet.Comentario = ""; vwRecibocajadet.Idcpventa = item.Idcpventa; vwRecibocajadet.DataEntityState = DataEntityState.Added; TipoMnt = vwRecibocajadet.Idrecibocajaingresodet <= 0 ? TipoMantenimiento.Nuevo : TipoMantenimiento.Modificar; switch (TipoMnt) { case TipoMantenimiento.Nuevo: //vwOrdendeventadet.Createdby = UsuarioAutenticado.UsuarioSel.Idusuario; //vwOrdendeventadet.Creationdate = DateTime.Now; break; case TipoMantenimiento.Modificar: //vwOrdendeventadet.Modifiedby = UsuarioAutenticado.UsuarioSel.Idusuario; //vwOrdendeventadet.Lastmodified = DateTime.Now; break; } sgtItem++; VwRecibocajadetList.Add(vwRecibocajadet); } DialogResult = DialogResult.OK; break; case "btnCancelarItem": DialogResult = DialogResult.Cancel; break; case "btnConsultar": if (!ValidacionDatosConsulta()) { return; } CargarCuentaCorriente(); break; case "btnCerrar": DialogResult = DialogResult.OK; break; } }