Ejemplo n.º 1
0
        private void popupWindowShowActionGetXml_Execute(object sender, DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs e)
        {
            CargaRecepcion obj   = e.PopupWindowViewCurrentObject as CargaRecepcion;
            IObjectSpace   objSp = Application.CreateObjectSpace();

            NegocioAdmin.CrgDeXml(obj, objSp);
        }
Ejemplo n.º 2
0
        private void popupWindowShowActionDscrgMsv_Execute(object sender, DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs e)
        {
            DescargaMasiva obj = e.PopupWindowViewCurrentObject as DescargaMasiva;

            if (obj != null)
            {
                NegocioAdmin.DescargaSat(obj, View.ObjectSpace, Prms);

                View.RefreshDataSource();
            }
        }
Ejemplo n.º 3
0
        private void popupWindowShowActionGetXml_Execute(object sender, DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs e)
        {
            IObjectSpace   objectSpace = Application.CreateObjectSpace();
            CargaRecepcion obj         = e.PopupWindowViewCurrentObject as CargaRecepcion;

            Empresa emprs = View.ObjectSpace.FindObject <Empresa>(null);
            Ventas  Prms  = objectSpace.FindObject <Ventas>(null);

            string aux = Path.Combine(obj.Rt, "Extract");

            string[] dirs = Directory.GetFiles(aux, "*.xml");
            foreach (string dir in dirs)
            {
                DocumentoSalida rcpcn = objectSpace.CreateObject <DocumentoSalida>();

                NegocioAdmin.ObtenXmlsVnts(rcpcn, emprs, Prms, dir);
                NegocioAdmin.GrabaDocumento(rcpcn, Prms, false);
                objectSpace.CommitChanges();

                string auxX = $"{rcpcn.FechaDoc.Year}{rcpcn.FechaDoc.Month:d2}{rcpcn.FechaDoc.Day:d2}{Path.GetFileName(dir)}";
                NegocioAdmin.Mueve(Path.GetDirectoryName(dir), Path.Combine(obj.Rt, "Factura"),
                                   Path.GetFileName(dir), auxX);
            }
        }
Ejemplo n.º 4
0
        private void popupWindowShowActionPresupuestoReal_Execute(object sender, DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs e)
        {
            PresupuestoFiltro obj = e.PopupWindowViewCurrentObject as PresupuestoFiltro;

            if (obj != null)
            {
                IObjectSpace       objectSpace = Application.CreateObjectSpace();
                List <MovimientoB> lista;
                GroupOperator      fil  = new GroupOperator();
                Presupuesto        prsu = objectSpace.FindObject <Presupuesto>(null);

                if (prsu != null)
                {
                    decimal suma;
                    foreach (ConceptoP cp in prsu.Partidas)
                    {
                        if (cp.Concepto != null)
                        {
                            fil.Operands.Clear();
                            fil.Operands.Add(CriteriaOperator.And(new BinaryOperator("FechaAplicacion", obj.FchIncl, BinaryOperatorType.GreaterOrEqual),
                                                                  new BinaryOperator("FechaAplicacion", obj.FchFnl, BinaryOperatorType.LessOrEqual)));
                            fil.Operands.Add(new BinaryOperator("Concepto", cp.Concepto));

                            IList col = objectSpace.CreateCollection(typeof(MovimientoB), fil);
                            lista = col.Cast <MovimientoB>().ToList();
                            if (lista != null && lista.Count > 0)
                            {
                                suma     = lista.Sum(item => item.Monto);
                                cp.MntRl = suma;
                            }
                            else
                            {
                                cp.MntRl = 0;
                            }
                        }
                    }

                    IList lis = objectSpace.CreateCollection(typeof(ConceptoB));
                    foreach (ConceptoB cpt in lis)
                    {
                        prsu.Partidas.Filter = new BinaryOperator("Concepto", cpt);
                        if (prsu.Partidas.Count == 0)
                        {
                            fil.Operands.Clear();
                            fil.Operands.Add(CriteriaOperator.And(new BinaryOperator("FechaAplicacion", obj.FchIncl, BinaryOperatorType.GreaterOrEqual),
                                                                  new BinaryOperator("FechaAplicacion", obj.FchFnl, BinaryOperatorType.LessOrEqual)));
                            fil.Operands.Add(new BinaryOperator("Concepto", cpt));

                            IList col = objectSpace.CreateCollection(typeof(MovimientoB), fil);
                            lista = col.Cast <MovimientoB>().ToList();
                            if (lista != null && lista.Count > 0)
                            {
                                suma = lista.Sum(item => item.Monto);

                                ConceptoP cp = objectSpace.CreateObject <ConceptoP>();
                                cp.Concepto = cpt;
                                cp.MntRl    = suma;

                                prsu.Partidas.Add(cp);
                            }
                        }
                    }

                    objectSpace.CommitChanges();
                    View.Refresh(true);
                }
            }
        }