예제 #1
0
 private async void MethodLoadSerieNumero(string CodDocumento)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             if (ESGR_VentaCuenta.Opcion == "I")
             {
                 CollectionESGR_DetalleVenta.OrderBy(x => x.ESGR_VentaCuenta.ESGR_Documento.CodDocumento);
                 var asd         = CollectionESGR_DetalleVenta;
                 var vrDocumento = (CollectionESGR_DetalleVenta.Count > 0) ? CollectionESGR_DetalleVenta.LastOrDefault(x => x.ESGR_VentaCuenta.ESGR_Documento.CodDocumento == CodDocumento) : null;
                 if (vrDocumento != null)
                 {
                     string Correlativo     = string.Empty;
                     ESGR_VentaCuenta.Serie = vrDocumento.ESGR_VentaCuenta.ESGR_Documento.Serie;
                     var strCorrelativo     = (Convert.ToInt32(vrDocumento.ESGR_VentaCuenta.Numero) + 1).ToString();
                     for (int item = 0; item < (vrDocumento.ESGR_VentaCuenta.ESGR_Documento.Longitud - strCorrelativo.Length); item++)
                     {
                         Correlativo += "0";
                     }
                     ESGR_VentaCuenta.Numero = Correlativo + strCorrelativo;
                 }
                 else
                 {
                     CollectionESGR_DocumentoSerieNumero.Source = new BSGR_Documento().GetCollectionDocumento(CodDocumento);
                     var FirstDocumentoSerieNumero = CollectionESGR_DocumentoSerieNumero.FirstOrDefault();
                     ESGR_VentaCuenta.Serie        = FirstDocumentoSerieNumero.Serie;
                     ESGR_VentaCuenta.Numero       = FirstDocumentoSerieNumero.Correlativo.ToString();
                 }
             }
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar);
         }
     });
 }
예제 #2
0
        private void MethodSetParameter(object value)
        {
            if (value is object[])
            {
                object[] Arreglo = (object[])value;

                #region REINICIO CALCULO

                Importe      = 0;
                ImporteDscto = 0;
                Efectivo     = 0;
                Vuelto       = 0;

                #endregion

                if (Arreglo[0] is ESGR_Venta)
                {
                    ESGR_VentaCuenta.ESGR_Venta = (ESGR_Venta)Arreglo[0];
                }
                if (Arreglo[2] is CmpObservableCollection <ESGR_VentaDetalle> )
                {
                    ESGR_VentaCuenta.Opcion             = "I";
                    CollectionESGR_PedidoDetalle.Source = (CmpObservableCollection <ESGR_PedidoDetalle>)Arreglo[1];
                    CollectionESGR_DetalleVenta.Source  = (CmpObservableCollection <ESGR_VentaDetalle>)Arreglo[2];
                    ESGR_VentaCuenta.IdCuenta           = (CollectionESGR_DetalleVenta.Count == 0) ? 1 : CollectionESGR_DetalleVenta.LastOrDefault().ESGR_VentaCuenta.IdCuenta + 1;
                    ESGR_VentaCuenta.Adicional          = 0;
                    ESGR_VentaCuenta.Descuento          = 0;
                    PropertyEnableUpdate                = true;
                    PropertyEnableUpdateAddOneCount     = true;
                    PropertyEnabledColumnCantidadAPagar = true;
                }
                else
                {
                    CollectionESGR_VentaDetalle.Source = (CmpObservableCollection <ESGR_VentaDetalle>)Arreglo[1];
                    CollectionESGR_VentaDetalle.OrderByDescending(x => x.Cantidad);
                    ESGR_VentaCuenta                    = (ESGR_VentaCuenta)Arreglo[2];
                    PropertyEnableUpdate                = (ESGR_VentaCuenta.Opcion != "U");
                    PropertyEnableUpdateAddOneCount     = false;
                    PropertyEnabledColumnCantidadAPagar = (ESGR_VentaCuenta.Opcion != "U");
                }
                MethodLoadHeader();
            }
        }