Esempio n. 1
0
 private void simpleActionRprtCntbl_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
 {
     if (View != null)
     {
         NegocioAdmin.ReporteContable(View.ObjectSpace);
     }
 }
Esempio n. 2
0
 private void actionShowMemory_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
 {
     GC.Collect();
     GC.GetTotalMemory(true);
     initialUsedMemory = GC.GetTotalMemory(true);
     throw new Exception(initialUsedMemory.ToString());
 }
Esempio n. 3
0
        ////protected override void OnActivated()
        ////{
        ////    this.TargetObjectType = typeof(IWorkCalendarEvent);
        ////    base.OnActivated();
        ////}

        protected override void ExecuteEdit(DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs args)
        {
            if (typeof(IWorkCalendarEvent).IsAssignableFrom(View.CurrentObject.GetType()))
            {
                WorkCalendarEvent workCalendarEvent = this.View.CurrentObject as WorkCalendarEvent;

                if (workCalendarEvent.JobCard != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.JobCard);
                }
                else if (workCalendarEvent.Project != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.Project);
                }
                else if (workCalendarEvent.WorkFlowTask != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.WorkFlowTask);
                }
                else if (workCalendarEvent.Task != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.Task);
                }
                else if (workCalendarEvent.Booking != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.Booking);
                }

                return;
            }

            base.ExecuteEdit(args);
        }
Esempio n. 4
0
 private void SimpleAction_EditDashboard_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
 {
     using (var uow = new UnitOfWork(XpoDefault.DataLayer))
     {
         var query = $"Delete From {nameof(DoSoExceptionLog)}";
         uow.ExecuteNonQuery(query);
         ObjectSpace.Refresh();
     }
 }
Esempio n. 5
0
        private void simpleActionCncilr_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            if (View != null && View.ObjectSpace != null)
            {
                IObjectSpace       objectSpace = Application.CreateObjectSpace();
                CriteriaOperator[] operands    = new CriteriaOperator[1];
                operands[0] = new BinaryOperator("Concilia", true, BinaryOperatorType.NotEqual);

                SortProperty[] sortCollection = new SortProperty[1];
                sortCollection[0] = new SortProperty("FechaDoc", SortingDirection.Ascending);

                IList arr = objectSpace.CreateCollection(typeof(DocumentoSalida),
                                                         new GroupOperator(operands), sortCollection);
                Ventas vta = objectSpace.FindObject <Ventas>(null);

                foreach (string file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.xml"))
                {
                    XmlDocument xml = new XmlDocument();

                    xml.Load(file);
                    XmlNodeList nl = xml.GetElementsByTagName("tfd:TimbreFiscalDigital");
                    if (nl != null && nl.Count > 0)
                    {
                        XmlNode se = nl[0].Attributes.GetNamedItem("UUID");
                        XmlNode fe = nl[0].Attributes.GetNamedItem("FechaTimbrado");
                        if (se != null)
                        {
                            foreach (DocumentoSalida fac in arr)
                            {
                                if (!string.IsNullOrEmpty(fac.Uuid))
                                {
                                    if (se.Value == fac.Uuid)
                                    {
                                        string aux;

                                        /*
                                         * string aux = Directory.GetCurrentDirectory();
                                         * aux = Path.Combine(aux, "Pdfs");*/
                                        aux = Path.Combine(vta.VntCfdi.RutaPdfVnts, fac.Tipo.ToString());
                                        aux = NegocioAdmin.CreaDirs(aux, fac.FechaDoc);

                                        aux = Path.Combine(aux, Path.GetFileName(file));
                                        // string.Format("{0}-{1}.xml", it.ReciboN, it.Uuid));
                                        File.Move(file, aux);

                                        // CreaPdfImprime(false, true, objectSpace);
                                        // NegocioNom.ImprFto("ReciboItem", false, true, NegocioNom.NamePdf(it), it, objectSpace);
                                        fac.Concilia = true;
                                    }
                                }
                            }
                        }
                    }
                }
                objectSpace.CommitChanges();
            }
        }
Esempio n. 6
0
        private void simpleActionCncilr_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            if (View != null && View.ObjectSpace != null)
            {
                IObjectSpace objectSpace = Application.CreateObjectSpace();

                NegocioAdmin.Concilia(objectSpace);

                objectSpace.CommitChanges();
            }
        }
Esempio n. 7
0
        private void simpleActionTestCadnOrgnl_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            Certificado cert = View.CurrentObject as Certificado;
            FacturaE    fac  = new FacturaE();

            NegocioAdmin.VaciaStructCert(fac, cert, View.ObjectSpace);
            fac.LeeInfoCFD(/*cert*/);
            if (fac.TestKy("Prueba de Genera Sello" /*, null*/))
            {
                // FacturaE.GeneraSello("||3.2|2014-01-13T15:39:40|ingreso|PAGO EN UNA SOLA EXHIBICION|10.00|0.00|1.00000|MXN|11.60|NO IDENTIFICADO|Uaxaca,|No Identificado|AAA010101AAA|EMPRESA INVALIDA|Calle empresa|Numero|Colonia|Delegacion|Uaxaca|MÉXICO|codig|Calle empresa|MÉXICO|Regimen de la empresa|XAXX010101000|Cliente de mostrador nacional|DISTRITO FEDERAL|MÉXICO|1|Kilogramo|SRVC|SERVICIO CON IMPUESTO|10.00|10.00|IVA|16|1.60|1.60||");
                XtraMessageBox.Show("Todo Bien !", "Certificado", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
        }
Esempio n. 8
0
        void todayFilterAction_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            bool applyFilter = ((CheckableSimpleAction)sender).Checked;

            if (applyFilter)
            {
                View.CollectionSource.Criteria["IsToday"] = new FunctionOperator(FunctionOperatorType.IsOutlookIntervalToday, new OperandProperty("Date"));
            }
            else
            {
                View.CollectionSource.Criteria.Remove("IsToday");
            }
        }
Esempio n. 9
0
        void activeFilterAction_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            bool applyFilter = ((CheckableSimpleAction)sender).Checked;

            if (applyFilter)
            {
                View.CollectionSource.Criteria["IsActive"] = new OperandProperty("Active");
            }
            else
            {
                View.CollectionSource.Criteria.Remove("IsActive");
            }
        }
        private void SalesOrderMarkAsResolvedAction_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            // Set Resolved flag on selected records.
            foreach (SalesOrder salesOrder in View.SelectedObjects.OfType <SalesOrder>())
            {
                salesOrder.Resolved = true;
            }

            // Save Changes only if the view is List View. On Detail View, we want to let user decide if changes should be saved or reverted.
            if (this.View is ListView)
            {
                this.ObjectSpace.CommitChanges();
            }
        }
Esempio n. 11
0
        void endTrackMemoryAction_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            DevExpress.Data.Helpers.LohPooled.PoolBase.FlushPools();
            GC.GetTotalMemory(true);
            long usedMemory = GC.GetTotalMemory(true);
            long memoryGrow = (usedMemory - initialUsedMemory) / (1024 * usedKB);

            if (memoryGrow > maxUsedMemory)
            {
                throw new Exception(memoryGrow.ToString());
            }
            else
            {
                throw new Exception(maxUsedMemory.ToString());
            }
        }
Esempio n. 12
0
        private void LoadDetailView(DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs args, object Workflow)
        {
            IObjectSpace objectSpace   = Application.CreateObjectSpace();
            Session      session       = ((XPObjectSpace)objectSpace).Session;
            object       currentObject = session.FindObject(Workflow.GetType(), CriteriaOperator.Parse("Oid == ?", (Workflow as BaseObject).Oid));

            DetailView view = Application.CreateDetailView(objectSpace, currentObject, true);

            view.ViewEditMode = DevExpress.ExpressApp.Editors.ViewEditMode.Edit;
            view.Closed      += View_Closed;

            args.ShowViewParameters.CreatedView     = view;
            args.ShowViewParameters.CreatedView.Tag = objectSpace.GetKeyValue(currentObject);
            args.ShowViewParameters.TargetWindow    = TargetWindow.NewModalWindow;
            args.ShowViewParameters.Context         = TemplateContext.PopupWindow;
        }
        private void simpleAction1_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            var lv = View as ListView;

            if (lv != null)
            {
                foreach (ProtocolRecordType recordType in lv.SelectedObjects)
                {
                    if (recordType.Code == null)
                    {
                        recordType.Code = recordType.GetDefaultCode();
                        recordType.Save();
                        ObjectSpace.CommitChanges();
                    }
                }
            }
        }
Esempio n. 14
0
        private void simpleActionACrs_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            if (View != null && View.CurrentObject != null)
            {
                Presupuesto prsu = View.CurrentObject as Presupuesto;

                if (prsu != null)
                {
                    foreach (ConceptoP cp in prsu.Partidas)
                    {
                        cp.MntRl = 0;
                    }
                    View.ObjectSpace.CommitChanges();
                    View.Refresh(true);
                }
            }
        }
Esempio n. 15
0
        private void Bestfit_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            ASPxGridListEditor gridListEditor = View.Editor as ASPxGridListEditor;

            if (gridListEditor != null)
            {
                ASPxGridView gridView = gridListEditor.Grid;
                gridView.Settings.UseFixedTableLayout     = true;
                gridView.Settings.HorizontalScrollBarMode = ScrollBarMode.Auto;
                gridView.Width = Unit.Percentage(100);
                foreach (WebColumnBase column in gridView.Columns)
                {
                    IColumnInfo columnInfo = ((IDataItemTemplateInfoProvider)gridListEditor).GetColumnInfo(column);
                    if (columnInfo != null)
                    {
                        IModelColumn modelColumn = (IModelColumn)columnInfo.Model;
                        column.Width = Unit.Pixel(200);
                    }
                }
            }
        }
Esempio n. 16
0
        private void MarkSalesOrderAsInvalidAction_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            int selectedRecordsCount = View.SelectedObjects.Count;

            if (selectedRecordsCount > 0)
            {
                // Get current employee
                Employee employee = SecuritySystem.CurrentUser as Employee;

                // Create a new builder to create message
                StringBuilder builder = new StringBuilder();
                if (selectedRecordsCount == 1)
                {
                    builder.AppendLine($"Following Sales Order record has been marked as Invalid by the '{employee}' employee:");
                }
                else
                {
                    builder.AppendLine($"Following Sales Order records have been marked as Invalid by the '{employee}' employee:");
                }

                // Set Invalid flag on selected records.
                foreach (SalesOrder salesOrder in View.SelectedObjects.OfType <SalesOrder>())
                {
                    salesOrder.Invalid = true;
                    builder.AppendLine($"- {salesOrder.OrderCode}");
                }


                // Send email message to the employee set in the Program Options as SalesOrder notification receiver.
                ProgramOptions programOptions = ProgramOptions.GetInstance(this.ObjectSpace.Session());
                if (programOptions != null)
                {
                    try
                    {
                        if (programOptions.SalesOrderNotificationAdministrator == null)
                        {
                            throw new Exception("Sales Order Notification Administrator is not set in the Program Options.\r\nPlease contact the administrator.");
                        }

                        if (string.IsNullOrEmpty(programOptions.SenderEmailAddress) || string.IsNullOrEmpty(programOptions.SenderEmailPassword) || programOptions.SMTPPort == 0 || string.IsNullOrEmpty(programOptions.SmtpClientName))
                        {
                            throw new Exception("Email configuration in the Program Options is missing. Please contact the administrator.");
                        }

                        MimeMessage message = new MimeMessage();
                        message.From.Add(new MailboxAddress($"{Application.ApplicationName} - Notification Service", programOptions.SenderEmailAddress));
                        message.To.Add(new MailboxAddress(programOptions.SalesOrderNotificationAdministrator.FullName, programOptions.SalesOrderNotificationAdministrator.Email));
                        message.Subject = $"{Application.ApplicationName} - Invalid Sales Orders";
                        message.Body    = new TextPart("plain")
                        {
                            Text = builder.ToString()
                        };

                        // Send the email
                        if (EmailHelper.SendEmail(this.ObjectSpace.Session(), message, out string errorMessage))
                        {
                            //TODO: Show confirmation message
                            ShowMessageService.Strategy.ShowDialog("The email has been successfully sent.", "Success", CustomMessageBoxButtons.OK, CutomMessageBoxIcon.Information);
                        }
                        else
                        {
                            //Show error information. Logging has been done in the SendEmail method.
                            throw new Exception($"An error occurred while sending the Email message to the '{programOptions.SalesOrderNotificationAdministrator.Email}':\n{errorMessage}");
                        }
                    }
                    catch (Exception ex)
                    {
                        this.ObjectSpace.Rollback(false);
                        throw;
                    }
                }

                // Save Changes
                this.ObjectSpace.CommitChanges();
            }
        }
Esempio n. 17
0
 private void NextObjectAction_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
 {
     Debug.Print("Next");
 }
Esempio n. 18
0
 private void action_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
 {
     GC.GetTotalMemory(true);
     initialUsedMemory = GC.GetTotalMemory(true);
 }
Esempio n. 19
0
 private void simpleActionGetXml_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
 {
 }
Esempio n. 20
0
        private void simpleActionRprtCntbl_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            if (View != null)
            {
                int     i   = 5;
                Empresa emp = View.ObjectSpace.FindObject <Empresa>(null);

                // Servicios Profesionales
                Workbook book  = new Workbook();
                var      sheet = book.Worksheets.ActiveWorksheet;
                sheet.Cells[0, 0].Value = emp.Compania.Nombre;
                sheet.Cells[0, 3].Value = emp.Compania.Rfc;
                sheet.Cells[1, 0].Value =
                    (emp.Regimenes != null && emp.Regimenes.Count > 0)
                    ? (emp.Regimenes[0] as RegimenEmpresa).Rgmn.Dscrpcn
                    : string.Empty;
                // emp.Regimen; TIT Sep 2018

                int ano = DateTime.Today.Month == 1 ? DateTime.Today.Year - 1 : DateTime.Today.Year;

                sheet.Cells["A4"].Value   = string.Format("Ejercicio {0}.", ano);
                sheet.Cells[i++, 0].Value = "ENERO";
                sheet.Cells[i++, 0].Value = "FEBRERO";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "MARZO";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "ABRIL";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "MAYO";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "JUNIO";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "JULIO";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "AGOSTO";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "SEPTIEMBRE";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "OCTUBRE";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "NOVIEMBRE";
                sheet.Cells[i++, 0].Value = "Acumulado";
                sheet.Cells[i++, 0].Value = "DICIEMBRE";
                sheet.Cells[i++, 0].Value = "Tota Acumulado";

                sheet.Cells["c3"].Value          = "ISR";
                sheet.Cells["c3"].Font.FontStyle = SpreadsheetFontStyle.Bold;


                // Access the range of cells to be formatted.
                CellRange range = sheet.Range["C4:G4"];

                // Begin updating of the range formatting.
                DevExpress.Spreadsheet.Formatting rangeFormatting = range.BeginUpdateFormatting();

                // Specify font settings (font name, color, size and style).
                rangeFormatting.Font.Name = "Arial";
                // rangeFormatting.Font.Color = Color.Blue;
                rangeFormatting.Font.Size = 8;
                // rangeFormatting.Font.FontStyle = SpreadsheetFontStyle.Bold;

                // Specify cell background color.
                rangeFormatting.Fill.BackgroundColor = Color.LightGray;

                // Specify text alignment in cells.
                rangeFormatting.Alignment.Vertical   = SpreadsheetVerticalAlignment.Center;
                rangeFormatting.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Center;
                rangeFormatting.Alignment.WrapText   = true;
                // End updating of the range formatting.
                range.EndUpdateFormatting(rangeFormatting);



                range = sheet.Range["G3:K3"];

                // Begin updating of the range formatting.
                rangeFormatting = range.BeginUpdateFormatting();

                // Specify font settings (font name, color, size and style).
                rangeFormatting.Font.Name = "Arial";
                // rangeFormatting.Font.Color = Color.Blue;
                rangeFormatting.Font.Size = 8;
                // rangeFormatting.Font.FontStyle = SpreadsheetFontStyle.Bold;

                // Specify cell background color.
                rangeFormatting.Fill.BackgroundColor = Color.LightGray;

                // Specify text alignment in cells.
                rangeFormatting.Alignment.Vertical   = SpreadsheetVerticalAlignment.Center;
                rangeFormatting.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Center;
                rangeFormatting.Alignment.WrapText   = true;

                // End updating of the range formatting.
                range.EndUpdateFormatting(rangeFormatting);


                sheet.Cells["c4"].Value = string.Format("INGRESOS{0}(Cobrados por sus{0}ventas o servicios){0}Sin incluir IVA",
                                                        Environment.NewLine);

                /*
                 * sheet.Cells["c4"].Alignment.Vertical = SpreadsheetVerticalAlignment.Justify;
                 * sheet.Cells["c4"].Alignment.Horizontal = SpreadsheetHorizontalAlignment.Center;
                 * sheet.Cells["c4"].Alignment.ShrinkToFit = true;
                 * sheet.Cells["c4"].Alignment.WrapText = true;*/

                sheet.Columns[2].Width = 350;
                sheet.Columns[3].Width = 340;
                sheet.Columns[4].Width = 340;

                sheet.Columns[6].Width  = 330;
                sheet.Columns[7].Width  = 330;
                sheet.Columns[8].Width  = 330;
                sheet.Columns[9].Width  = 330;
                sheet.Columns[10].Width = 330;


                sheet.Cells["d4"].Value = string.Format("DEDUCCIONES{0}(Compras y/o{0}gastos, sin incluir{0}IVA",
                                                        Environment.NewLine);
                sheet.Cells["e4"].Value = string.Format("INGRESOS ACUMULABLES -{0}DEDUCCIONES ACUMULABLES ={0}BASE",
                                                        Environment.NewLine);
                sheet.Cells["f4"].Value = "ISR RETENIDO";

                sheet.Cells["g3"].Value = "PAGOS (Provisionales)";
                sheet.Cells["g4"].Value = "ISR";
                sheet.Rows[3].Height    = 260;

                sheet.Cells["h3"].Value = string.Format("IVA{0}(Causado por{0}sus ventas o{0}servicios)",
                                                        Environment.NewLine);
                sheet.Cells["i3"].Value = string.Format("IVA{0}(Acreditable por{0}sus compras y/o{0}gastos)",
                                                        Environment.NewLine);
                sheet.Cells["j3"].Value = string.Format("IVA{0}RETENIDO", Environment.NewLine);
                sheet.Cells["k3"].Value = string.Format("IVA PAGADO (+){0}O{0}A FAVOR (-)", Environment.NewLine);
                sheet.Cells["l3"].Value = "DIOT";
                sheet.Rows[2].Height    = 240;

                decimal[] total     = new decimal[12];
                decimal[] reten     = new decimal[12];
                decimal[] ivaTras   = new decimal[12];
                decimal[] ivaRet    = new decimal[12];
                decimal[] ivaAcr    = new decimal[12];
                decimal[] totAcm    = new decimal[12];
                decimal[] retAcm    = new decimal[12];
                decimal[] totalDdc  = new decimal[12];
                decimal[] totAcmDdc = new decimal[12];

                CriteriaOperator[] operands = new CriteriaOperator[2];

                i           = 5;
                operands[1] = new BinaryOperator("Status", DocumentoStatus.Sellada, BinaryOperatorType.Equal);
                for (int mesini = 1; mesini < 13; mesini++)
                {
                    DateTime mFechaIni = apl.Log.Fecha.FechaInicial(mesini, ano);
                    DateTime mFechaFin = apl.Log.Fecha.FechaFinal(mesini, ano);

                    operands[0] = GroupOperator.And(
                        new BinaryOperator("FechaDoc", mFechaIni, BinaryOperatorType.GreaterOrEqual),
                        new BinaryOperator("FechaDoc", mFechaFin, BinaryOperatorType.LessOrEqual));
                    operands[1] = new BinaryOperator("Status", DocumentoStatus.Sellada, BinaryOperatorType.Equal);

                    IList arr = ((XPObjectSpace)View.ObjectSpace).CreateCollection(typeof(DocumentoSalida), new GroupOperator(operands), null);

                    total[mesini - 1]     = 0;
                    totAcm[mesini - 1]    = 0;
                    reten[mesini - 1]     = 0;
                    retAcm[mesini - 1]    = 0;
                    ivaTras[mesini - 1]   = 0;
                    ivaRet[mesini - 1]    = 0;
                    ivaAcr[mesini - 1]    = 0;
                    totalDdc[mesini - 1]  = 0;
                    totAcmDdc[mesini - 1] = 0;

                    if (arr.Count > 0)
                    {
                        foreach (DocumentoSalida doc in arr)
                        {
                            total[mesini - 1]   += doc.SubTotal;
                            reten[mesini - 1]   += doc.RetenISR;
                            ivaTras[mesini - 1] += doc.Impuesto04;
                            ivaRet[mesini - 1]  += doc.RetenIVA;
                        }
                    }


                    operands[0] = GroupOperator.And(
                        new BinaryOperator("FechaDoc", mFechaIni, BinaryOperatorType.GreaterOrEqual),
                        new BinaryOperator("FechaDoc", mFechaFin, BinaryOperatorType.LessOrEqual));
                    operands[1] = null;

                    arr = ((XPObjectSpace)View.ObjectSpace).CreateCollection(typeof(Recepcion), new GroupOperator(operands), null);

                    if (arr.Count > 0)
                    {
                        foreach (Recepcion doc in arr)
                        {
                            totalDdc[mesini - 1] += doc.SubTotal;
                            ivaAcr[mesini - 1]   += doc.Impuesto04;
                        }
                    }


                    if ((mesini - 1) > 0)
                    {
                        //     1, 2, ...,11          0, 1, ...,10        1, 2, ...,11
                        totAcm[mesini - 1]    += totAcm[mesini - 2] + total[mesini - 1];
                        retAcm[mesini - 1]    += retAcm[mesini - 2] + reten[mesini - 1];
                        totAcmDdc[mesini - 1] += totAcmDdc[mesini - 2] + totalDdc[mesini - 1];
                    }
                    else
                    {
                        //     0                   0
                        totAcm[mesini - 1]    = total[mesini - 1];
                        retAcm[mesini - 1]    = reten[mesini - 1];
                        totAcmDdc[mesini - 1] = totalDdc[mesini - 1];
                    }



                    if (total[mesini - 1] != 0)
                    {
                        sheet.Cells[i, 2].SetValue(total[mesini - 1]);
                        sheet.Cells[i, 2].NumberFormat = "$#,##0.00;[Red]$#,##0.00";
                    }
                    if (totalDdc[mesini - 1] != 0)
                    {
                        sheet.Cells[i, 3].SetValue(totalDdc[mesini - 1]);
                        sheet.Cells[i, 3].NumberFormat = "$#,##0.00;[Red]$#,##0.00";
                    }

                    if (reten[mesini - 1] != 0)
                    {
                        sheet.Cells[i, 5].SetValue(reten[mesini - 1]);
                        sheet.Cells[i, 5].NumberFormat = "$#,##0.00;[Red]$#,##0.00";
                    }

                    if (ivaTras[mesini - 1] != 0)
                    {
                        sheet.Cells[i, 7].SetValue(ivaTras[mesini - 1]);
                        sheet.Cells[i, 7].NumberFormat = "$#,##0.00;[Red]$#,##0.00";
                    }
                    if (ivaAcr[mesini - 1] != 0)
                    {
                        sheet.Cells[i, 8].SetValue(ivaAcr[mesini - 1]);
                        sheet.Cells[i, 8].NumberFormat = "$#,##0.00;[Red]$#,##0.00";
                    }
                    if (ivaRet[mesini - 1] != 0)
                    {
                        sheet.Cells[i, 9].SetValue(ivaRet[mesini - 1]);
                        sheet.Cells[i, 9].NumberFormat = "$#,##0.00;[Red]$#,##0.00";
                    }
                    sheet.Cells[i, 10].Formula        = string.Format("=h{0}-i{0}-j{0}", i + 1);
                    sheet.Cells[i++, 10].NumberFormat = "$#,##0.00;[Red]$#,##0.00";

                    if (mesini > 1)
                    {
                        sheet.Rows[i].FillColor = Color.FromName("BurlyWood");
                        //Beige"); // AntiqueWhite"); Bisque BlanchedAlmond

                        if (totAcm[mesini - 1] != 0)
                        {
                            sheet.Cells[i, 2].SetValue(totAcm[mesini - 1]);
                            sheet.Cells[i, 2].NumberFormat = "$#,##0.00;[Red]$#,##0.00";
                        }
                        if (totAcmDdc[mesini - 1] != 0)
                        {
                            sheet.Cells[i, 3].SetValue(totAcmDdc[mesini - 1]);
                            sheet.Cells[i, 3].NumberFormat = "$#,##0.00;[Red]$#,##0.00";
                        }
                        sheet.Cells[i, 4].Formula      = string.Format("=c{0}-d{0}", i + 1);
                        sheet.Cells[i, 4].NumberFormat = "$#,##0.00;[Red]$#,##0.00";

                        if (retAcm[mesini - 1] != 0)
                        {
                            sheet.Cells[i, 5].SetValue(retAcm[mesini - 1]);
                            sheet.Cells[i++, 5].NumberFormat = "$#,##0.00;[Red]$#,##0.00";
                        }
                        else
                        {
                            i++;
                        }
                    }
                }

                book.SaveDocument(string.Format("Contable.xls"));
            }

            /*
             * Workbook book = new Workbook();
             * var sheet = book.Worksheets.ActiveWorksheet;
             * sheet.Cells[0, 0].Value = "Carlos Javier Lopez Cruz";
             * sheet.Cells[1, 0].Value = "LOCC670416JI8";
             * // sheet.Cells[1, 1].Value = "litros67";
             * int ano = DateTime.Today.Month == 1 ? DateTime.Today.Year-1 : DateTime.Today.Year;
             *  // DateTime.Today.Year;
             *
             * sheet.Cells["A4"].Value = string.Format("Determinación del ISR provisional del Ejercicio {0}.",
             *  ano);
             *
             * sheet.Cells[5, 1].Value = "ENERO";
             * sheet.Cells[5, 4].Value = "FEBRERO";
             * sheet.Cells[5, 7].Value = "MARZO";
             * sheet.Cells[5, 10].Value = "ABRIL";
             * sheet.Cells[5, 13].Value = "MAYO";
             * sheet.Cells[5, 16].Value = "JUNIO";
             * sheet.Cells[5, 19].Value = "JULIO";
             * sheet.Cells[5, 22].Value = "AGOSTO";
             * sheet.Cells[5, 25].Value = "SEPTIEMBRE";
             * sheet.Cells[5, 28].Value = "OCTUBRE";
             * sheet.Cells[5, 31].Value = "NOVIEMBRE";
             * sheet.Cells[5, 34].Value = "DICIEMBRE";
             *
             *
             * XPObjectSpace objectSpace = (XPObjectSpace)View.ObjectSpace;
             * Empresa emp = objectSpace.FindObject<Empresa>(null);
             *
             * CriteriaOperator[] operands = new CriteriaOperator[2];
             * decimal[] total = new decimal[12];
             * decimal[] totAcm = new decimal[12];
             * decimal[] compr = new decimal[12];
             * decimal[] reten = new decimal[12];
             * decimal[] retAcm = new decimal[12];
             * decimal[] ivaTras = new decimal[12];
             * decimal[] ivaRet = new decimal[12];
             * decimal[] ivaAcr = new decimal[12];
             *
             * operands[1] = new BinaryOperator("Status", DocumentoStatus.Cancelado, BinaryOperatorType.NotEqual);
             *
             * sheet.Cells["A1"].Value = emp.Compania.Nombre;
             * sheet.Cells["B1"].Value = emp.Compania.Rfc;
             *
             * for (int mesini = 1; mesini < 13; mesini++)
             * {
             *  DateTime mFechaIni = Fecha.FechaInicial(mesini, ano);
             *  DateTime mFechaFin = Fecha.FechaFinal(mesini, ano);
             *
             *  operands[0] = GroupOperator.And(new BinaryOperator("FechaDoc", mFechaIni, BinaryOperatorType.GreaterOrEqual),
             *      new BinaryOperator("FechaDoc", mFechaFin, BinaryOperatorType.LessOrEqual));
             *
             *  IList arr = objectSpace.CreateCollection(typeof(DocumentoSalida), new GroupOperator(operands), null);
             *
             *  total[mesini - 1] = 0;
             *  totAcm[mesini - 1] = 0;
             *  reten[mesini - 1] = 0;
             *  retAcm[mesini - 1] = 0;
             *  ivaTras[mesini - 1] = 0;
             *  ivaRet[mesini - 1] = 0;
             *  ivaAcr[mesini - 1] = 0;
             *  if (arr.Count > 0)
             *  {
             *      foreach (DocumentoSalida doc in arr)
             *      {
             *          total[mesini - 1] += doc.SubTotal;
             *          reten[mesini - 1] += doc.RetenISR;
             *          ivaTras[mesini - 1] += doc.Impuesto04;
             *          ivaRet[mesini - 1] += doc.RetenIVA;
             *      }
             *
             *      if ((mesini - 1) > 0)
             *      {
             *          totAcm[mesini - 1] += totAcm[mesini - 2] + total[mesini - 2];
             *          retAcm[mesini - 1] += retAcm[mesini - 2] + reten[mesini - 2];
             *      }
             *  }
             * }
             *
             * sheet.Cells[6, 0].ColumnWidth = 470;
             * sheet.Cells["A7"].Value = "Ingresos Acumulados:";
             * sheet.Cells[6, 1].Value = 0;
             * sheet.Cells[6, 4].Value = total[0].ToString("n2");
             * sheet.Cells[6, 7].Value = (total[0] + total[1]).ToString("n2");
             * sheet.Cells[6, 10].Value = (total[0] + total[1] + total[2]).ToString("n2");
             * sheet.Cells[6, 13].Value = (total[0] + total[1] + total[2]
             + total[3]).ToString("n2");
             + sheet.Cells[6, 16].Value = (total[0] + total[1] + total[2]
             + total[3] + total[4]).ToString("n2");
             + sheet.Cells[6, 19].Value = (total[0] + total[1] + total[2]
             + total[3] + total[4] + total[5]).ToString("n2");
             + sheet.Cells[6, 22].Value = (total[0] + total[1] + total[2]
             + total[3] + total[4] + total[5] + total[6]).ToString("n2");
             + sheet.Cells[6, 25].Value = (total[0] + total[1] + total[2]
             + total[3] + total[4] + total[5] + total[6] + total[7]).ToString("n2");
             + sheet.Cells[6, 28].Value = (total[0] + total[1] + total[2]
             + total[3] + total[4] + total[5] + total[6] + total[7]
             + total[8]).ToString("n2");
             + sheet.Cells[6, 31].Value = (total[0] + total[1] + total[2]
             + total[3] + total[4] + total[5] + total[6] + total[7]
             + total[8] + total[9]).ToString("n2");
             + sheet.Cells[6, 34].Value = (total[0] + total[1] + total[2]
             + total[3] + total[4] + total[5] + total[6] + total[7]
             + total[8] + total[9] + total[10]).ToString("n2");
             +
             + sheet.Cells["A8"].Value = "Ingresos:";
             + sheet.Cells[7, 1].Value = total[0].ToString("n2");
             + sheet.Cells[7, 4].Value = total[1].ToString("n2");
             + sheet.Cells[7, 7].Value = total[2].ToString("n2");
             + sheet.Cells[7, 10].Value = total[3].ToString("n2");
             + sheet.Cells[7, 13].Value = total[4].ToString("n2");
             + sheet.Cells[7, 16].Value = total[5].ToString("n2");
             + sheet.Cells[7, 19].Value = total[6].ToString("n2");
             + sheet.Cells[7, 22].Value = total[7].ToString("n2");
             + sheet.Cells[7, 25].Value = total[8].ToString("n2");
             + sheet.Cells[7, 28].Value = total[9].ToString("n2");
             + sheet.Cells[7, 31].Value = total[10].ToString("n2");
             + sheet.Cells[7, 34].Value = total[11].ToString("n2");
             +
             + sheet.Cells["A9"].Value = "Total de Ingresos:";
             + sheet.Cells[8, 2].Value = (total[0] + totAcm[0]).ToString("n2");
             + sheet.Cells[8, 5].Value = (total[1] + totAcm[1]).ToString("n2");
             + sheet.Cells[8, 8].Value = (total[2] + totAcm[2]).ToString("n2");
             + sheet.Cells[8, 11].Value = (total[3] + totAcm[3]).ToString("n2");
             + sheet.Cells[8, 14].Value = (total[4] + totAcm[4]).ToString("n2");
             + sheet.Cells[8, 17].Value = (total[5] + totAcm[5]).ToString("n2");
             + sheet.Cells[8, 20].Value = (total[6] + totAcm[6]).ToString("n2");
             + sheet.Cells[8, 23].Value = (total[7] + totAcm[7]).ToString("n2");
             + sheet.Cells[8, 26].Value = (total[8] + totAcm[8]).ToString("n2");
             + sheet.Cells[8, 29].Value = (total[9] + totAcm[9]).ToString("n2");
             + sheet.Cells[8, 32].Value = (total[10] + totAcm[10]).ToString("n2");
             + sheet.Cells[8, 35].Value = (total[11] + totAcm[11]).ToString("n2");
             +
             +
             +
             + decimal[] totalDdc = new decimal[12];
             + decimal[] totAcmDdc = new decimal[12];
             + for (int mesini = 1; mesini < 13; mesini++)
             + {
             +  DateTime mFechaIni = Fecha.FechaInicial(mesini, ano);
             +  DateTime mFechaFin = Fecha.FechaFinal(mesini, ano);
             +
             +  operands[0] = GroupOperator.And(new BinaryOperator("FechaDoc", mFechaIni, BinaryOperatorType.GreaterOrEqual),
             +      new BinaryOperator("FechaDoc", mFechaFin, BinaryOperatorType.LessOrEqual));
             +
             +  IList arr = objectSpace.CreateCollection(typeof(Recepcion), new GroupOperator(operands), null);
             +
             +  totalDdc[mesini - 1] = 0;
             +  totAcmDdc[mesini - 1] = 0;
             +  ivaAcr[mesini - 1] = 0;
             +  if (arr.Count > 0)
             +  {
             +      foreach (Recepcion doc in arr)
             +      {
             +          totalDdc[mesini - 1] += doc.SubTotal;
             +          ivaAcr[mesini - 1] += doc.Impuesto04;
             +      }
             +
             +      if ((mesini - 1) > 0)
             +          totAcmDdc[mesini - 1] += totAcmDdc[mesini - 2] + totalDdc[mesini - 2];
             +  }
             + }
             +
             + sheet.Cells[9, 0].Value = "Deducciones Acumuladas:";
             + sheet.Cells[9, 1].Value = totAcmDdc[0].ToString("n2");
             + sheet.Cells[9, 4].Value = totAcmDdc[1].ToString("n2");
             + sheet.Cells[9, 7].Value = totAcmDdc[2].ToString("n2");
             + sheet.Cells[9, 10].Value = totAcmDdc[3].ToString("n2");
             + sheet.Cells[9, 13].Value = totAcmDdc[4].ToString("n2");
             + sheet.Cells[9, 16].Value = totAcmDdc[5].ToString("n2");
             + sheet.Cells[9, 19].Value = totAcmDdc[6].ToString("n2");
             + sheet.Cells[9, 22].Value = totAcmDdc[7].ToString("n2");
             + sheet.Cells[9, 25].Value = totAcmDdc[8].ToString("n2");
             + sheet.Cells[9, 28].Value = totAcmDdc[9].ToString("n2");
             + sheet.Cells[9, 31].Value = totAcmDdc[10].ToString("n2");
             + sheet.Cells[9, 34].Value = totAcmDdc[11].ToString("n2");
             +
             + int ren = 10;
             + sheet.Cells[ren, 0].Value = "Deducciones:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 1+3*i].Value = totalDdc[i].ToString("n2");
             +
             + ren = 11;
             + sheet.Cells[ren, 0].Value = "Total de Deducciones:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 2+3*i].Value = (totalDdc[i] + totAcmDdc[i]).ToString("n2");
             +
             + ren++;
             + sheet.Cells[++ren, 0].Value = "Base ISR:";
             + for (int i = 0; i < 12; i++)
             + {
             +  sheet[ren, 2+3*i].Value = (total[i] + totAcm[i]- (totalDdc[i] + totAcmDdc[i])) > 0
             +      ? (total[i] + totAcm[i] - (totalDdc[i] + totAcmDdc[i])).ToString("n2") : "-";
             + }
             +
             + sheet.Cells[++ren, 0].Value = "Límite Inferior:";
             + sheet.Cells[++ren, 0].Value = "Excedente L.I.:";
             + sheet.Cells[++ren, 0].Value = "% Marginal:";
             + sheet.Cells[++ren, 0].Value = "Impuesto Marginal:";
             + sheet.Cells[++ren, 0].Value = "Cuotra fija:";
             + sheet.Cells[++ren, 0].Value = "ISR Causado:";
             +
             + ren++;
             + ren++;
             + sheet.Cells[ren, 0].Value = "Retenciones Acumuladas:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 1+3*i].Value = retAcm[i].ToString("n2");
             +
             + ren++;
             + sheet.Cells[ren, 0].Value = "Retención ISR:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 1 + 3 * i].Value = reten[i].ToString("n2");
             +
             + ren++;
             + sheet.Cells[ren, 0].Value = "Total de Retenciones:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 2 + 3 * i].Value = (reten[i] + retAcm[i]).ToString("n2");
             +
             + ren++;
             + sheet.Cells[++ren, 0].Value = "Determinacion del Impuesto al Valor Agregado Mensual del Ejercicio 2014";
             +
             + ren++;
             + ren++;
             + sheet.Cells[ren, 0].Value = "IVA trasladado:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 1 + 3 * i].Value = ivaTras[i].ToString("n2");
             +
             + ren++;
             + sheet.Cells[ren, 0].Value = "Retención IVA:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 1 + 3 * i].Value = ivaRet[i].ToString("n2");
             +
             + ren++;
             + sheet.Cells[ren, 0].Value = "IVA Acreditable:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 1 + 3 * i].Value = ivaAcr[i].ToString("n2");
             +
             + ren++;
             + sheet.Cells[ren, 0].Value = "Saldo a favor de IVA:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 1 + 3 * i].Value =  ivaTras[i] - ivaRet[i]-ivaAcr[i] > 0 ? "0" :
             +      Math.Round(ivaAcr[i] + ivaRet[i] - ivaTras[i]).ToString("n2");
             +
             + ren++;
             + sheet.Cells[ren, 0].Value = "Saldo a pagar de IVA:";
             + for (int i = 0; i < 12; i++)
             +  sheet.Cells[ren, 1 + 3 * i].Value = ivaTras[i] - ivaRet[i] - ivaAcr[i] > 0 ?
             +      Math.Round(ivaTras[i] - ivaRet[i] - ivaAcr[i]).ToString("n2") : "0";
             +
             + book.SaveDocument(string.Format("Contable.xls"));*/
        }
Esempio n. 21
0
 private void simpleActionGetXml_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
 {
     /*
      * NegocioAdmin.ObtenXmlsVnts(View.ObjectSpace);*/
 }
Esempio n. 22
0
 private void RecursiveFilterPopLookUpTreeSelectionSimpleAction_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
 {
     recursive = true;
     Frame.GetController <ListViewProcessCurrentObjectController>().ProcessCurrentObjectAction.DoExecute();
 }