diff --git a/Fonts/OpenSans-CondBold.ttf b/Fonts/OpenSans-CondBold.ttf new file mode 100644 index 0000000..83966f2 Binary files /dev/null and b/Fonts/OpenSans-CondBold.ttf differ diff --git a/Fonts/UbuntuCondensed-Regular.ttf b/Fonts/UbuntuCondensed-Regular.ttf new file mode 100644 index 0000000..602a3ee Binary files /dev/null and b/Fonts/UbuntuCondensed-Regular.ttf differ diff --git a/src/ACBr.Net.Sat.Demo/ACBr.Net.Sat.Demo.csproj b/src/ACBr.Net.Sat.Demo/ACBr.Net.Sat.Demo.csproj index 47191e0..0f6c995 100644 --- a/src/ACBr.Net.Sat.Demo/ACBr.Net.Sat.Demo.csproj +++ b/src/ACBr.Net.Sat.Demo/ACBr.Net.Sat.Demo.csproj @@ -83,6 +83,7 @@ Resources.resx True + SettingsSingleFileGenerator Settings.Designer.cs @@ -97,6 +98,10 @@ + + {7e78f7eb-71c8-4ba6-ad2a-80ee10ee2d99} + ACBr.Net.Sat.Extrato.FastReport.OpenSource + {ee443d74-27e7-4236-851e-5e31a8ab8e63} ACBr.Net.Sat @@ -104,19 +109,19 @@ - 1.2.4.1 + 1.2.5 - 1.2.8 + 1.2.8.3 - 1.2.0.6 + 1.2.0.9 - 4.7.3 + 4.7.9 - 4.3.0 + 4.4.0 diff --git a/src/ACBr.Net.Sat.Demo/App.config b/src/ACBr.Net.Sat.Demo/App.config new file mode 100644 index 0000000..1d22da3 --- /dev/null +++ b/src/ACBr.Net.Sat.Demo/App.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/ACBr.Net.Sat.Demo/FrmMain.Designer.cs b/src/ACBr.Net.Sat.Demo/FrmMain.Designer.cs index 63a2b47..168ad71 100644 --- a/src/ACBr.Net.Sat.Demo/FrmMain.Designer.cs +++ b/src/ACBr.Net.Sat.Demo/FrmMain.Designer.cs @@ -28,6 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); this.tpgLog = new System.Windows.Forms.TabPage(); this.rtbLog = new System.Windows.Forms.RichTextBox(); @@ -141,8 +142,21 @@ private void InitializeComponent() this.groupBox3 = new System.Windows.Forms.GroupBox(); this.btnParamSave = new System.Windows.Forms.Button(); this.btnParamLoad = new System.Windows.Forms.Button(); - this.acbrIntegrador = new ACBr.Net.Integrador.ACBrIntegrador(); - this.acbrSat = new ACBr.Net.Sat.ACBrSat(); + this.label20 = new System.Windows.Forms.Label(); + this.nudEspacoFinal = new System.Windows.Forms.NumericUpDown(); + this.groupBoxExportacao = new System.Windows.Forms.GroupBox(); + this.cmbFiltro = new System.Windows.Forms.ComboBox(); + this.label21 = new System.Windows.Forms.Label(); + this.txtExportacao = new System.Windows.Forms.TextBox(); + this.btnExportacao = new System.Windows.Forms.Button(); + this.label22 = new System.Windows.Forms.Label(); + this.chkSetup = new System.Windows.Forms.CheckBox(); + this.chkPreview = new System.Windows.Forms.CheckBox(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.pctLogo = new System.Windows.Forms.PictureBox(); + this.contextMenuStripImage = new System.Windows.Forms.ContextMenuStrip(this.components); + this.carregarImagemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.limparLogoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tpgLog.SuspendLayout(); this.tbcXml.SuspendLayout(); this.tpgXmlGerado.SuspendLayout(); @@ -160,9 +174,15 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.nunCaixa)).BeginInit(); this.tpgEmitente.SuspendLayout(); this.tpgSwHouse.SuspendLayout(); + this.tpgImpressao.SuspendLayout(); this.tpgMFe.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nunMFeTimeout)).BeginInit(); this.groupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudEspacoFinal)).BeginInit(); + this.groupBoxExportacao.SuspendLayout(); + this.groupBox4.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pctLogo)).BeginInit(); + this.contextMenuStripImage.SuspendLayout(); this.SuspendLayout(); // // tpgLog @@ -329,52 +349,52 @@ private void InitializeComponent() // ativarSATToolStripMenuItem // this.ativarSATToolStripMenuItem.Name = "ativarSATToolStripMenuItem"; - this.ativarSATToolStripMenuItem.Size = new System.Drawing.Size(214, 22); + this.ativarSATToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.ativarSATToolStripMenuItem.Text = "Ativar SAT"; this.ativarSATToolStripMenuItem.Click += new System.EventHandler(this.ativarSATToolStripMenuItem_Click); // // comunicarCertificadoToolStripMenuItem // this.comunicarCertificadoToolStripMenuItem.Name = "comunicarCertificadoToolStripMenuItem"; - this.comunicarCertificadoToolStripMenuItem.Size = new System.Drawing.Size(214, 22); + this.comunicarCertificadoToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.comunicarCertificadoToolStripMenuItem.Text = "Comunicar Certificado"; this.comunicarCertificadoToolStripMenuItem.Click += new System.EventHandler(this.comunicarCertificadoToolStripMenuItem_Click); // // associarAssinaturaToolStripMenuItem // this.associarAssinaturaToolStripMenuItem.Name = "associarAssinaturaToolStripMenuItem"; - this.associarAssinaturaToolStripMenuItem.Size = new System.Drawing.Size(214, 22); + this.associarAssinaturaToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.associarAssinaturaToolStripMenuItem.Text = "Associar Assinatura"; this.associarAssinaturaToolStripMenuItem.Click += new System.EventHandler(this.associarAssinaturaToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(211, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(210, 6); // // bloquearSATToolStripMenuItem // this.bloquearSATToolStripMenuItem.Name = "bloquearSATToolStripMenuItem"; - this.bloquearSATToolStripMenuItem.Size = new System.Drawing.Size(214, 22); + this.bloquearSATToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.bloquearSATToolStripMenuItem.Text = "Bloquear SAT"; this.bloquearSATToolStripMenuItem.Click += new System.EventHandler(this.bloquearSATToolStripMenuItem_Click); // // desbloquearSATToolStripMenuItem // this.desbloquearSATToolStripMenuItem.Name = "desbloquearSATToolStripMenuItem"; - this.desbloquearSATToolStripMenuItem.Size = new System.Drawing.Size(214, 22); + this.desbloquearSATToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.desbloquearSATToolStripMenuItem.Text = "Desbloquear SAT"; this.desbloquearSATToolStripMenuItem.Click += new System.EventHandler(this.desbloquearSATToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(211, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(210, 6); // // trocarCódigoDeAtivaçãoToolStripMenuItem // this.trocarCódigoDeAtivaçãoToolStripMenuItem.Name = "trocarCódigoDeAtivaçãoToolStripMenuItem"; - this.trocarCódigoDeAtivaçãoToolStripMenuItem.Size = new System.Drawing.Size(214, 22); + this.trocarCódigoDeAtivaçãoToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.trocarCódigoDeAtivaçãoToolStripMenuItem.Text = "Trocar Código de Ativação"; this.trocarCódigoDeAtivaçãoToolStripMenuItem.Click += new System.EventHandler(this.trocarCódigoDeAtivaçãoToolStripMenuItem_Click); // @@ -394,40 +414,40 @@ private void InitializeComponent() // gerarVendaToolStripMenuItem // this.gerarVendaToolStripMenuItem.Name = "gerarVendaToolStripMenuItem"; - this.gerarVendaToolStripMenuItem.Size = new System.Drawing.Size(250, 22); + this.gerarVendaToolStripMenuItem.Size = new System.Drawing.Size(251, 22); this.gerarVendaToolStripMenuItem.Text = "Gerar Venda"; this.gerarVendaToolStripMenuItem.Click += new System.EventHandler(this.gerarVendaToolStripMenuItem_Click); // // enviarVendaToolStripMenuItem // this.enviarVendaToolStripMenuItem.Name = "enviarVendaToolStripMenuItem"; - this.enviarVendaToolStripMenuItem.Size = new System.Drawing.Size(250, 22); + this.enviarVendaToolStripMenuItem.Size = new System.Drawing.Size(251, 22); this.enviarVendaToolStripMenuItem.Text = "Enviar Venda"; this.enviarVendaToolStripMenuItem.Click += new System.EventHandler(this.enviarVendaToolStripMenuItem_Click); // // imprimirExtratoVendaToolStripMenuItem // this.imprimirExtratoVendaToolStripMenuItem.Name = "imprimirExtratoVendaToolStripMenuItem"; - this.imprimirExtratoVendaToolStripMenuItem.Size = new System.Drawing.Size(250, 22); + this.imprimirExtratoVendaToolStripMenuItem.Size = new System.Drawing.Size(251, 22); this.imprimirExtratoVendaToolStripMenuItem.Text = "Imprimir Extrato Venda"; this.imprimirExtratoVendaToolStripMenuItem.Click += new System.EventHandler(this.imprimirExtratoVendaToolStripMenuItem_Click); // // imprimirExtratoVendaResumidoToolStripMenuItem // this.imprimirExtratoVendaResumidoToolStripMenuItem.Name = "imprimirExtratoVendaResumidoToolStripMenuItem"; - this.imprimirExtratoVendaResumidoToolStripMenuItem.Size = new System.Drawing.Size(250, 22); + this.imprimirExtratoVendaResumidoToolStripMenuItem.Size = new System.Drawing.Size(251, 22); this.imprimirExtratoVendaResumidoToolStripMenuItem.Text = "Imprimir Extrato Venda Resumido"; this.imprimirExtratoVendaResumidoToolStripMenuItem.Click += new System.EventHandler(this.imprimirExtratoVendaResumidoToolStripMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(247, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(248, 6); // // carregarXMLToolStripMenuItem // this.carregarXMLToolStripMenuItem.Name = "carregarXMLToolStripMenuItem"; - this.carregarXMLToolStripMenuItem.Size = new System.Drawing.Size(250, 22); + this.carregarXMLToolStripMenuItem.Size = new System.Drawing.Size(251, 22); this.carregarXMLToolStripMenuItem.Text = "Carregar XML"; this.carregarXMLToolStripMenuItem.Click += new System.EventHandler(this.carregarXMLToolStripMenuItem_Click); // @@ -444,21 +464,21 @@ private void InitializeComponent() // gerarXMLCancelamentoToolStripMenuItem // this.gerarXMLCancelamentoToolStripMenuItem.Name = "gerarXMLCancelamentoToolStripMenuItem"; - this.gerarXMLCancelamentoToolStripMenuItem.Size = new System.Drawing.Size(239, 22); + this.gerarXMLCancelamentoToolStripMenuItem.Size = new System.Drawing.Size(240, 22); this.gerarXMLCancelamentoToolStripMenuItem.Text = "Gerar XML Cancelamento"; this.gerarXMLCancelamentoToolStripMenuItem.Click += new System.EventHandler(this.gerarXMLCancelamentoToolStripMenuItem_Click); // // enviarCancelamentoToolStripMenuItem // this.enviarCancelamentoToolStripMenuItem.Name = "enviarCancelamentoToolStripMenuItem"; - this.enviarCancelamentoToolStripMenuItem.Size = new System.Drawing.Size(239, 22); + this.enviarCancelamentoToolStripMenuItem.Size = new System.Drawing.Size(240, 22); this.enviarCancelamentoToolStripMenuItem.Text = "Enviar Cancelamento"; this.enviarCancelamentoToolStripMenuItem.Click += new System.EventHandler(this.enviarCancelamentoToolStripMenuItem_Click); // // imprimirExtratoCancelamentoToolStripMenuItem // this.imprimirExtratoCancelamentoToolStripMenuItem.Name = "imprimirExtratoCancelamentoToolStripMenuItem"; - this.imprimirExtratoCancelamentoToolStripMenuItem.Size = new System.Drawing.Size(239, 22); + this.imprimirExtratoCancelamentoToolStripMenuItem.Size = new System.Drawing.Size(240, 22); this.imprimirExtratoCancelamentoToolStripMenuItem.Text = "Imprimir Extrato Cancelamento"; this.imprimirExtratoCancelamentoToolStripMenuItem.Click += new System.EventHandler(this.imprimirExtratoCancelamentoToolStripMenuItem_Click); // @@ -556,14 +576,14 @@ private void InitializeComponent() // testeFimAFimToolStripMenuItem // this.testeFimAFimToolStripMenuItem.Name = "testeFimAFimToolStripMenuItem"; - this.testeFimAFimToolStripMenuItem.Size = new System.Drawing.Size(156, 22); + this.testeFimAFimToolStripMenuItem.Size = new System.Drawing.Size(155, 22); this.testeFimAFimToolStripMenuItem.Text = "Teste Fim a Fim"; this.testeFimAFimToolStripMenuItem.Click += new System.EventHandler(this.testeFimAFimToolStripMenuItem_Click); // // extrairLogsToolStripMenuItem // this.extrairLogsToolStripMenuItem.Name = "extrairLogsToolStripMenuItem"; - this.extrairLogsToolStripMenuItem.Size = new System.Drawing.Size(156, 22); + this.extrairLogsToolStripMenuItem.Size = new System.Drawing.Size(155, 22); this.extrairLogsToolStripMenuItem.Text = "Extrair Logs"; this.extrairLogsToolStripMenuItem.Click += new System.EventHandler(this.extrairLogsToolStripMenuItem_Click); // @@ -1089,6 +1109,12 @@ private void InitializeComponent() // // tpgImpressao // + this.tpgImpressao.Controls.Add(this.label20); + this.tpgImpressao.Controls.Add(this.nudEspacoFinal); + this.tpgImpressao.Controls.Add(this.groupBoxExportacao); + this.tpgImpressao.Controls.Add(this.chkSetup); + this.tpgImpressao.Controls.Add(this.chkPreview); + this.tpgImpressao.Controls.Add(this.groupBox4); this.tpgImpressao.Location = new System.Drawing.Point(4, 22); this.tpgImpressao.Name = "tpgImpressao"; this.tpgImpressao.Padding = new System.Windows.Forms.Padding(3); @@ -1308,54 +1334,152 @@ private void InitializeComponent() this.btnParamLoad.UseVisualStyleBackColor = true; this.btnParamLoad.Click += new System.EventHandler(this.btnParamLoad_Click); // - // acbrIntegrador - // - this.acbrIntegrador.Configuracoes.ChaveAcessoValidador = ""; - this.acbrIntegrador.Configuracoes.PastaInput = "C:\\Integrador\\Input\\"; - this.acbrIntegrador.Configuracoes.PastaOutput = "C:\\Integrador\\Output\\"; - this.acbrIntegrador.Configuracoes.TimeOut = 45000; - this.acbrIntegrador.NomeComponente = ""; - this.acbrIntegrador.NomeMetodo = ""; - // - // acbrSat - // - this.acbrSat.Arquivos.PastaCFeCancelamento = "C:\\Users\\rften\\AppData\\Local\\Microsoft\\VisualStudio\\15.0_ba1d4182\\ProjectAssembli" + - "es\\itw3chll01\\Cancelamentos"; - this.acbrSat.Arquivos.PastaCFeVenda = "C:\\Users\\rften\\AppData\\Local\\Microsoft\\VisualStudio\\15.0_ba1d4182\\ProjectAssembli" + - "es\\itw3chll01\\Vendas"; - this.acbrSat.Arquivos.PastaEnvio = "C:\\Users\\rften\\AppData\\Local\\Microsoft\\VisualStudio\\15.0_ba1d4182\\ProjectAssembli" + - "es\\itw3chll01\\Enviado"; - this.acbrSat.Arquivos.PrefixoArqCFe = "AD"; - this.acbrSat.Arquivos.PrefixoArqCFeCanc = "ADC"; - this.acbrSat.Arquivos.SalvarCFe = false; - this.acbrSat.Arquivos.SalvarCFeCanc = false; - this.acbrSat.Arquivos.SalvarEnvio = false; - this.acbrSat.Arquivos.SepararPorCNPJ = false; - this.acbrSat.Arquivos.SepararPorMes = false; - this.acbrSat.CodigoAtivacao = "123456"; - this.acbrSat.Configuracoes.EmitCNPJ = "11111111111111"; - this.acbrSat.Configuracoes.EmitCRegTrib = ACBr.Net.Sat.RegTrib.Normal; - this.acbrSat.Configuracoes.EmitCRegTribISSQN = ACBr.Net.Sat.RegTribIssqn.Nenhum; - this.acbrSat.Configuracoes.EmitIE = ""; - this.acbrSat.Configuracoes.EmitIM = ""; - this.acbrSat.Configuracoes.EmitIndRatISSQN = ACBr.Net.Sat.RatIssqn.Nao; - this.acbrSat.Configuracoes.IdeCNPJ = "11111111111111"; - this.acbrSat.Configuracoes.IdeNumeroCaixa = 1; - this.acbrSat.Configuracoes.IdeTpAmb = ACBr.Net.DFe.Core.Common.DFeTipoAmbiente.Homologacao; - this.acbrSat.Configuracoes.InfCFeVersaoDadosEnt = new decimal(new int[] { - 6, - 0, - 0, - 131072}); - this.acbrSat.Configuracoes.IsUtf8 = true; - this.acbrSat.Configuracoes.NumeroTentativasValidarSessao = 1; - this.acbrSat.Configuracoes.RemoverAcentos = false; - this.acbrSat.Configuracoes.ValidarNumeroSessaoResposta = false; - this.acbrSat.Encoding = ((System.Text.Encoding)(resources.GetObject("acbrSat.Encoding"))); - this.acbrSat.IntegradorFiscal = this.acbrIntegrador; - this.acbrSat.Modelo = ACBr.Net.Sat.ModeloSat.Cdecl; - this.acbrSat.PathDll = "C:\\SAT\\SAT.dll"; - this.acbrSat.SignAC = ""; + // label20 + // + this.label20.AutoSize = true; + this.label20.Location = new System.Drawing.Point(445, 24); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(68, 13); + this.label20.TabIndex = 14; + this.label20.Text = "Espaço Final"; + // + // nudEspacoFinal + // + this.nudEspacoFinal.DecimalPlaces = 2; + this.nudEspacoFinal.Location = new System.Drawing.Point(519, 22); + this.nudEspacoFinal.Name = "nudEspacoFinal"; + this.nudEspacoFinal.Size = new System.Drawing.Size(60, 20); + this.nudEspacoFinal.TabIndex = 13; + this.nudEspacoFinal.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nudEspacoFinal.ValueChanged += new System.EventHandler(this.nudEspacoFinal_ValueChanged); + // + // groupBoxExportacao + // + this.groupBoxExportacao.Controls.Add(this.cmbFiltro); + this.groupBoxExportacao.Controls.Add(this.label21); + this.groupBoxExportacao.Controls.Add(this.txtExportacao); + this.groupBoxExportacao.Controls.Add(this.btnExportacao); + this.groupBoxExportacao.Controls.Add(this.label22); + this.groupBoxExportacao.Location = new System.Drawing.Point(174, 45); + this.groupBoxExportacao.Name = "groupBoxExportacao"; + this.groupBoxExportacao.Size = new System.Drawing.Size(405, 108); + this.groupBoxExportacao.TabIndex = 12; + this.groupBoxExportacao.TabStop = false; + this.groupBoxExportacao.Text = "Exportação"; + // + // cmbFiltro + // + this.cmbFiltro.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbFiltro.Location = new System.Drawing.Point(6, 42); + this.cmbFiltro.Name = "cmbFiltro"; + this.cmbFiltro.Size = new System.Drawing.Size(165, 21); + this.cmbFiltro.TabIndex = 8; + this.cmbFiltro.SelectedIndexChanged += new System.EventHandler(this.cmbFiltro_SelectedIndexChanged); + // + // label21 + // + this.label21.AutoSize = true; + this.label21.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label21.Location = new System.Drawing.Point(6, 26); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(35, 13); + this.label21.TabIndex = 6; + this.label21.Text = "Filtro"; + // + // txtExportacao + // + this.txtExportacao.Enabled = false; + this.txtExportacao.Location = new System.Drawing.Point(6, 82); + this.txtExportacao.Name = "txtExportacao"; + this.txtExportacao.Size = new System.Drawing.Size(348, 20); + this.txtExportacao.TabIndex = 4; + // + // btnExportacao + // + this.btnExportacao.Enabled = false; + this.btnExportacao.Location = new System.Drawing.Point(360, 82); + this.btnExportacao.Name = "btnExportacao"; + this.btnExportacao.Size = new System.Drawing.Size(24, 20); + this.btnExportacao.TabIndex = 5; + this.btnExportacao.Text = "..."; + this.btnExportacao.UseVisualStyleBackColor = true; + this.btnExportacao.Click += new System.EventHandler(this.btnExportacao_Click); + // + // label22 + // + this.label22.AutoSize = true; + this.label22.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label22.Location = new System.Drawing.Point(6, 66); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(118, 13); + this.label22.TabIndex = 3; + this.label22.Text = "Arquivo Exportação"; + // + // chkSetup + // + this.chkSetup.AutoSize = true; + this.chkSetup.Location = new System.Drawing.Point(282, 22); + this.chkSetup.Name = "chkSetup"; + this.chkSetup.Size = new System.Drawing.Size(92, 17); + this.chkSetup.TabIndex = 11; + this.chkSetup.Text = "Mostrar Setup"; + this.chkSetup.UseVisualStyleBackColor = true; + this.chkSetup.CheckedChanged += new System.EventHandler(this.chkSetup_CheckedChanged); + // + // chkPreview + // + this.chkPreview.AutoSize = true; + this.chkPreview.Location = new System.Drawing.Point(174, 22); + this.chkPreview.Name = "chkPreview"; + this.chkPreview.Size = new System.Drawing.Size(102, 17); + this.chkPreview.TabIndex = 10; + this.chkPreview.Text = "Mostrar Preview"; + this.chkPreview.UseVisualStyleBackColor = true; + this.chkPreview.CheckedChanged += new System.EventHandler(this.chkPreview_CheckedChanged); + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.pctLogo); + this.groupBox4.Location = new System.Drawing.Point(9, 6); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(159, 147); + this.groupBox4.TabIndex = 9; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Logo"; + // + // pctLogo + // + this.pctLogo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pctLogo.ContextMenuStrip = this.contextMenuStripImage; + this.pctLogo.Dock = System.Windows.Forms.DockStyle.Fill; + this.pctLogo.Location = new System.Drawing.Point(3, 16); + this.pctLogo.Name = "pctLogo"; + this.pctLogo.Size = new System.Drawing.Size(153, 128); + this.pctLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pctLogo.TabIndex = 0; + this.pctLogo.TabStop = false; + // + // contextMenuStripImage + // + this.contextMenuStripImage.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.carregarImagemToolStripMenuItem, + this.limparLogoToolStripMenuItem}); + this.contextMenuStripImage.Name = "contextMenuStripImage"; + this.contextMenuStripImage.Size = new System.Drawing.Size(150, 48); + // + // carregarImagemToolStripMenuItem + // + this.carregarImagemToolStripMenuItem.Name = "carregarImagemToolStripMenuItem"; + this.carregarImagemToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.carregarImagemToolStripMenuItem.Text = "Carregar Logo"; + this.carregarImagemToolStripMenuItem.Click += new System.EventHandler(this.carregarImagemToolStripMenuItem_Click); + // + // limparLogoToolStripMenuItem + // + this.limparLogoToolStripMenuItem.Name = "limparLogoToolStripMenuItem"; + this.limparLogoToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.limparLogoToolStripMenuItem.Text = "Limpar Logo"; + this.limparLogoToolStripMenuItem.Click += new System.EventHandler(this.limparLogoToolStripMenuItem_Click); // // FrmMain // @@ -1401,10 +1525,18 @@ private void InitializeComponent() this.tpgEmitente.PerformLayout(); this.tpgSwHouse.ResumeLayout(false); this.tpgSwHouse.PerformLayout(); + this.tpgImpressao.ResumeLayout(false); + this.tpgImpressao.PerformLayout(); this.tpgMFe.ResumeLayout(false); this.tpgMFe.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nunMFeTimeout)).EndInit(); this.groupBox3.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.nudEspacoFinal)).EndInit(); + this.groupBoxExportacao.ResumeLayout(false); + this.groupBoxExportacao.PerformLayout(); + this.groupBox4.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pctLogo)).EndInit(); + this.contextMenuStripImage.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -1524,8 +1656,21 @@ private void InitializeComponent() private System.Windows.Forms.Button btnEnviarPagamento; private System.Windows.Forms.TextBox txtChaveAcessoValidador; private System.Windows.Forms.Label label19; - private Integrador.ACBrIntegrador acbrIntegrador; - private ACBrSat acbrSat; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.NumericUpDown nudEspacoFinal; + private System.Windows.Forms.GroupBox groupBoxExportacao; + private System.Windows.Forms.ComboBox cmbFiltro; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.TextBox txtExportacao; + private System.Windows.Forms.Button btnExportacao; + private System.Windows.Forms.Label label22; + private System.Windows.Forms.CheckBox chkSetup; + private System.Windows.Forms.CheckBox chkPreview; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.PictureBox pctLogo; + private System.Windows.Forms.ContextMenuStrip contextMenuStripImage; + private System.Windows.Forms.ToolStripMenuItem carregarImagemToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem limparLogoToolStripMenuItem; } } diff --git a/src/ACBr.Net.Sat.Demo/FrmMain.cs b/src/ACBr.Net.Sat.Demo/FrmMain.cs index 92d4f61..f8133e5 100644 --- a/src/ACBr.Net.Sat.Demo/FrmMain.cs +++ b/src/ACBr.Net.Sat.Demo/FrmMain.cs @@ -6,9 +6,12 @@ using NLog.Windows.Forms; using System; using System.Diagnostics; +using System.Drawing; using System.IO; using System.Text; using System.Windows.Forms; +using ACBr.Net.Integrador; +using ACBr.Net.Sat.Extrato.FastReport.OpenSource; namespace ACBr.Net.Sat.Demo { @@ -21,6 +24,8 @@ public partial class FrmMain : Form private CFeCanc cfeCancAtual; private SatRede redeAtual; private readonly ACBrConfig config; + private ACBrSat acbrSat; + private ACBrIntegrador acbrIntegrador; #endregion Fields @@ -44,11 +49,18 @@ private void FrmMain_Shown(object sender, EventArgs e) private void Initialize() { + acbrIntegrador = new ACBrIntegrador(); + acbrSat = new ACBrSat + { + Extrato = new ExtratoFastReport() + }; + cmbAmbiente.EnumDataSource(DFeTipoAmbiente.Homologacao); cmbModeloSat.EnumDataSource(ModeloSat.StdCall); cmbEmiRegTrib.EnumDataSource(RegTrib.Normal); cmbEmiRegTribISSQN.EnumDataSource(RegTribIssqn.Nenhum); cmbEmiRatIISQN.EnumDataSource(RatIssqn.Nao); + cmbFiltro.EnumDataSource(FiltroDFeReport.Nenhum); } private void InitializeLog() @@ -226,6 +238,29 @@ private void LoadConfig() nunMFeTimeout.Value = config.Get("MFeTimeOut", 45000M); txtChaveAcessoValidador.Text = config.Get("ChaveAcessoValidador", @"25CFE38D-3B92-46C0-91CA-CFF751A82D3D"); + //Extrato + var img = config.Get("ExtratoLogo", string.Empty); + if (img.IsEmpty()) + { + pctLogo.Image?.Dispose(); + pctLogo.Image = null; + + acbrSat.Extrato.Logo?.Dispose(); + acbrSat.Extrato.Logo = null; + } + else + { + var imgBytes = Convert.FromBase64String(img); + pctLogo.Image = imgBytes.ToImage(); + acbrSat.Extrato.Logo = pctLogo.Image; + } + + chkPreview.Checked = config.Get("ExtratoPreview", false); + chkSetup.Checked = config.Get("ExtratoSetup", false); + cmbFiltro.SelectedItem = config.Get("ExtratoFiltro", FiltroDFeReport.Nenhum); + txtExportacao.Text = config.Get("ExtratoFiltroArquivo", string.Empty); + nudEspacoFinal.Value = config.Get("ExtratoEspacoFinal", 0M); + MessageBox.Show(this, @"Configurações Carregada com sucesso !", @"S@T Demo"); } @@ -258,12 +293,19 @@ private void SaveConfig(bool msg = true) config.Set("MFePathResposta", txtMFeResposta.Text); config.Set("MFeTimeOut", nunMFeTimeout.Value); config.Set("ChaveAcessoValidador", txtChaveAcessoValidador.Text); + + //Extrato + config.Set("ExtratoLogo", pctLogo.Image.ToBase64()); + config.Set("ExtratoPreview", chkPreview.Checked); + config.Set("ExtratoSetup", chkSetup.Checked); + config.Set("ExtratoFiltro", cmbFiltro.SelectedItem); + config.Set("ExtratoFiltroArquivo", txtExportacao.Text); + config.Set("ExtratoEspacoFinal", nudEspacoFinal.Value); + config.Save(); if (msg) - { MessageBox.Show(this, @"Configurações Salva com sucesso !", @"S@T Demo"); - } } private void ConsultarStatusOperacional() @@ -303,7 +345,7 @@ private void comunicarCertificadoToolStripMenuItem_Click(object sender, EventArg { if (!acbrSat.Ativo) ToogleInitialize(); logger.Info("Comunicar certificado."); - var file = Helpers.OpenFiles(@"Certificado|*.cer|Arquivo Texto|*.txt"); + var file = Helpers.OpenFile(@"Certificado|*.cer|Arquivo Texto|*.txt"); if (file.IsEmpty()) { logger.Info("Comunicar certificado Cancelado."); @@ -391,7 +433,7 @@ private void imprimirExtratoVendaResumidoToolStripMenuItem_Click(object sender, private void carregarXMLToolStripMenuItem_Click(object sender, EventArgs e) { logger.Info("Carregar XML CFe."); - var file = Helpers.OpenFiles(@"CFe Xml | *.xml"); + var file = Helpers.OpenFile(@"CFe Xml | *.xml"); if (file.IsEmpty()) { logger.Info("Carregar XML CFe Cancelado."); @@ -482,7 +524,7 @@ private void atualizarSATToolStripMenuItem_Click(object sender, EventArgs e) private void lerXMLConfiguraçãoDeInterfaceDeRedeToolStripMenuItem_Click(object sender, EventArgs e) { logger.Info("Carregar XML Rede."); - var file = Helpers.OpenFiles(@"Xml Rede | *.xml"); + var file = Helpers.OpenFile(@"Xml Rede | *.xml"); if (file.IsEmpty()) { logger.Info("Carregar XML Rede Cancelado."); @@ -680,6 +722,29 @@ private void txtChaveAcessoValidador_TextChanged(object sender, EventArgs e) acbrIntegrador.Configuracoes.ChaveAcessoValidador = txtChaveAcessoValidador.Text; } + private void chkPreview_CheckedChanged(object sender, EventArgs e) + { + acbrSat.Extrato.MostrarPreview = chkPreview.Checked; + } + + private void chkSetup_CheckedChanged(object sender, EventArgs e) + { + acbrSat.Extrato.MostrarSetup = chkSetup.Checked; + } + + private void nudEspacoFinal_ValueChanged(object sender, EventArgs e) + { + ((ExtratoFastReport)acbrSat.Extrato).EspacoFinal = nudEspacoFinal.Value; + } + + private void cmbFiltro_SelectedIndexChanged(object sender, EventArgs e) + { + acbrSat.Extrato.Filtro = (FiltroDFeReport)cmbFiltro.SelectedItem; + + txtExportacao.Enabled = acbrSat.Extrato.Filtro != FiltroDFeReport.Nenhum; + btnExportacao.Enabled = acbrSat.Extrato.Filtro != FiltroDFeReport.Nenhum; + } + #endregion ValueChanged #region Botoes @@ -701,7 +766,7 @@ private void btnParamSave_Click(object sender, EventArgs e) private void btnSelDll_Click(object sender, EventArgs e) { - var file = Helpers.OpenFiles(@"Sat Library | *.dll"); + var file = Helpers.OpenFile(@"Sat Library | *.dll"); if (!file.IsEmpty()) txtDllPath.Text = file; } @@ -782,6 +847,32 @@ private void btnRespostaFiscal_Click(object sender, EventArgs e) wbrXmlRecebido.LoadXml(resposta.GetXml()); } + private void carregarImagemToolStripMenuItem_Click(object sender, EventArgs e) + { + var file = Helpers.OpenFile(@"Images(*.BMP; *.JPG; *.GIF,*.PNG,*.TIFF)| *.BMP; *.JPG; *.GIF; *.PNG; *.TIFF"); + if (file.IsEmpty()) return; + + var img = Image.FromFile(file); + pctLogo.Image = img; + acbrSat.Extrato.Logo = img; + } + + private void limparLogoToolStripMenuItem_Click(object sender, EventArgs e) + { + pctLogo.Image?.Dispose(); + pctLogo.Image = null; + + acbrSat.Extrato.Logo?.Dispose(); + acbrSat.Extrato.Logo = null; + } + + private void btnExportacao_Click(object sender, EventArgs e) + { + var extensao = acbrSat.Extrato.Filtro == FiltroDFeReport.HTML ? ".html" : ".pdf"; + var file = Helpers.SaveFile($"ExtratoSat", $"Extrato Sat (*{extensao}) | *{extensao}"); + txtExportacao.Text = file; + } + #endregion Botoes #endregion EventHandlers diff --git a/src/ACBr.Net.Sat.Demo/FrmMain.resx b/src/ACBr.Net.Sat.Demo/FrmMain.resx index 47ce7f5..1927564 100644 --- a/src/ACBr.Net.Sat.Demo/FrmMain.resx +++ b/src/ACBr.Net.Sat.Demo/FrmMain.resx @@ -123,30 +123,9 @@ 117, 17 - + 232, 17 - - 373, 17 - - - - AAEAAAD/////AQAAAAAAAAAEAQAAABhTeXN0ZW0uVGV4dC5VVEY4RW5jb2RpbmcLAAAAEmVtaXRVVEY4 - SWRlbnRpZmllchBpc1Rocm93RXhjZXB0aW9uCm1fY29kZVBhZ2UIZGF0YUl0ZW0PZW5jb2RlckZhbGxi - YWNrD2RlY29kZXJGYWxsYmFjaxNFbmNvZGluZyttX2NvZGVQYWdlEUVuY29kaW5nK2RhdGFJdGVtFUVu - Y29kaW5nK21faXNSZWFkT25seRhFbmNvZGluZytlbmNvZGVyRmFsbGJhY2sYRW5jb2RpbmcrZGVjb2Rl - ckZhbGxiYWNrAAAAAwMDAAMAAwMBAQglU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29kZVBhZ2VEYXRhSXRl - bSZTeXN0ZW0uVGV4dC5FbmNvZGVyUmVwbGFjZW1lbnRGYWxsYmFjayZTeXN0ZW0uVGV4dC5EZWNvZGVy - UmVwbGFjZW1lbnRGYWxsYmFjawglU3lzdGVtLkdsb2JhbGl6YXRpb24uQ29kZVBhZ2VEYXRhSXRlbQEm - U3lzdGVtLlRleHQuRW5jb2RlclJlcGxhY2VtZW50RmFsbGJhY2smU3lzdGVtLlRleHQuRGVjb2RlclJl - cGxhY2VtZW50RmFsbGJhY2sBAOn9AAAKCQIAAAAJAwAAAOn9AAAKAQkCAAAACQMAAAAEAgAAACZTeXN0 - ZW0uVGV4dC5FbmNvZGVyUmVwbGFjZW1lbnRGYWxsYmFjawMAAAAKc3RyRGVmYXVsdBtiSXNNaWNyb3Nv - ZnRCZXN0Rml0RmFsbGJhY2srRW5jb2RlckZhbGxiYWNrK2JJc01pY3Jvc29mdEJlc3RGaXRGYWxsYmFj - awEAAAEBBgYAAAAD77+9AAAEAwAAACZTeXN0ZW0uVGV4dC5EZWNvZGVyUmVwbGFjZW1lbnRGYWxsYmFj - awMAAAAKc3RyRGVmYXVsdBtiSXNNaWNyb3NvZnRCZXN0Rml0RmFsbGJhY2srRGVjb2RlckZhbGxiYWNr - K2JJc01pY3Jvc29mdEJlc3RGaXRGYWxsYmFjawEAAAEBCQYAAAAAAAs= - - 59 diff --git a/src/ACBr.Net.Sat.Demo/Helpers.cs b/src/ACBr.Net.Sat.Demo/Helpers.cs index fd5828d..95611fe 100644 --- a/src/ACBr.Net.Sat.Demo/Helpers.cs +++ b/src/ACBr.Net.Sat.Demo/Helpers.cs @@ -2,22 +2,32 @@ namespace ACBr.Net.Sat.Demo { - public static class Helpers - { - public static string OpenFiles(string filters) - { - using (var ofd = new OpenFileDialog()) - { - ofd.CheckPathExists = true; - ofd.CheckFileExists = true; - ofd.Multiselect = false; - ofd.Filter = filters; + public static class Helpers + { + public static string OpenFile(string filters) + { + using (var ofd = new OpenFileDialog()) + { + ofd.CheckPathExists = true; + ofd.CheckFileExists = true; + ofd.Multiselect = false; + ofd.Filter = filters; - if (ofd.ShowDialog().Equals(DialogResult.Cancel)) - return null; + return ofd.ShowDialog().Equals(DialogResult.Cancel) ? null : ofd.FileName; + } + } - return ofd.FileName; - } - } - } + public static string SaveFile(string filename, string filter) + { + using (var sfd = new SaveFileDialog()) + { + sfd.CheckPathExists = true; + sfd.CheckFileExists = true; + sfd.Filter = filter; + sfd.FileName = filename; + + return sfd.ShowDialog().Equals(DialogResult.Cancel) ? null : sfd.FileName; + } + } + } } \ No newline at end of file diff --git a/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/ACBr.Net.Sat.Extrato.FastReport.OpenSource.csproj b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/ACBr.Net.Sat.Extrato.FastReport.OpenSource.csproj new file mode 100644 index 0000000..d590f33 --- /dev/null +++ b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/ACBr.Net.Sat.Extrato.FastReport.OpenSource.csproj @@ -0,0 +1,89 @@ + + + + net452;netstandard2.0 + ACBr.Net.Sat.Extrato.FastReport.OpenSource + ACBr.Net.Sat.Extrato.FastReport.OpenSource + true + acbr.net.snk + Copyright © Grupo ACBr.Net 2014 - 2021 + Grupo ACBr.Net + Rafael Dias + https://acbrnet.github.io + true + https://avatars2.githubusercontent.com/u/7342977?v=3&amp;s=200 + https://github.com/ACBrNet/ACBr.Net.Sat + git + ACBr ACBr.Net SAT CF-e-SAT Extrato Automação Comercial + Biblioteca para utilização do SAT/MFe + pt-BR + LICENSE + 1.0.0.0 + 1.0.0.0 + 1.0.0.0 + true + true + true + snupkg + ACBr.Net.Sat.Extrato.FastReport.OpenSource + + + + NETCORE;NETSTANDARD;NETSTANDARD2_0 + + + + NET45;NETFULL + + + + ..\..\bin\Debug\ + ..\..\bin\Debug\net452\ACBr.Net.Sat.Extrato.FastReport.OpenSource.xml + + + + ..\..\bin\Release\ + ..\..\bin\Release\net452\ACBr.Net.Sat.Extrato.FastReport.OpenSource.xml + + + + ..\..\bin\Debug\ + ..\..\bin\Debug\netstandard2.0\ACBr.Net.Sat.Extrato.FastReport.OpenSource.xml + + + + ..\..\bin\Release\ + ..\..\bin\Release\netstandard2.0\ACBr.Net.Sat.Extrato.FastReport.OpenSource.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + + + + \ No newline at end of file diff --git a/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/Extensions.cs b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/Extensions.cs new file mode 100644 index 0000000..a0503b3 --- /dev/null +++ b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/Extensions.cs @@ -0,0 +1,23 @@ +namespace ACBr.Net.Sat.Extrato.FastReport.OpenSource +{ + public static class Extensions + { + public static string Descricao(this CodigoMP codigo) + { + switch (codigo) + { + case CodigoMP.Dinheiro: return "Dinheiro"; + case CodigoMP.Cheque: return "Cheque"; + case CodigoMP.CartaodeCredito: return "Cartão de Crédito"; + case CodigoMP.CartaodeDebito: return "Cartão de Débito"; + case CodigoMP.CreditoLoja: return "Crédito Loja"; + case CodigoMP.ValeAlimentacao: return "Vale Alimentação"; + case CodigoMP.ValeRefeicao: return "Vale Refeição"; + case CodigoMP.ValePresente: return "Vale Presente"; + case CodigoMP.ValeCombustivel: return "Vale Combustível"; + case CodigoMP.Outros: return "Outros"; + default: return "Outros"; + } + } + } +} \ No newline at end of file diff --git a/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/Extrato/ExtratoSat.frx b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/Extrato/ExtratoSat.frx new file mode 100644 index 0000000..1a8f76b --- /dev/null +++ b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/Extrato/ExtratoSat.frx @@ -0,0 +1,542 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using System.Text.RegularExpressions; + +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +using ACBr.Net.Core.Extensions; +using ACBr.Net.DFe.Core.Common; +using ACBr.Net.Sat; +using ACBr.Net.Sat.Extrato.FastReport.OpenSource; + +namespace FastReport +{ + public class ReportScript + { + private void rtbTitulo_BeforePrint(object sender, EventArgs e) + { + var imagem = (byte[])(Report.GetParameterValue("Logo") ?? new byte[0]); + if(imagem.Length < 1) + { + rtbTitulo.Height = 10f; + poEmitLogo.Visible = false; + return; + } + + poEmitLogo.SetImageData(imagem); + } + + private void TextNumeroExtrato_BeforePrint(object sender, EventArgs e) + { + var ambiente = (DFeTipoAmbiente)Report.GetParameterValue("Ambiente"); + var numeroCFe = (int)Report.GetColumnValue("CFe.InfCFe.Ide.NCFe"); + TextNumeroExtrato.Text = "Extrato Nº " + (ambiente == DFeTipoAmbiente.Homologacao ? "000000" : numeroCFe.ToString()); + } + + private void TextClienteCPFCNPJ_BeforePrint(object sender, EventArgs e) + { + var documentoDest = "CPF/CNPJ do Consumidor : "; + var cnpj = (string)Report.GetColumnValue("CFe.InfCFe.Dest.CNPJ"); + var cpf = (string)Report.GetColumnValue("CFe.InfCFe.Dest.CPF"); + + TextClienteCPFCNPJ.Text = ""; + + if (!string.IsNullOrEmpty(cnpj)) + { + if(cnpj.OnlyNumbers() == "00000000000000") return; + + TextClienteCPFCNPJ.Text = documentoDest + cnpj.FormataCNPJ(); + } + else + { + if(cpf.OnlyNumbers() == "00000000000") return; + + TextClienteCPFCNPJ.Text = documentoDest + cpf.FormataCPF(); + } + } + + private void phbEmitenteTeste_BeforePrint(object sender, EventArgs e) + { + var ambiente = (DFeTipoAmbiente)Report.GetParameterValue("Ambiente"); + phbEmitenteTeste.Visible = ambiente == DFeTipoAmbiente.Homologacao; + if(phbEmitenteTeste.Visible) + { + phbEmitenteExtrato.Border.Lines = BorderLines.Top; + } + } + + private void ghbProdutosUmaLinha_BeforePrint(object sender, EventArgs e) + { + var oneLine = (bool)Report.GetParameterValue("IsOneLine"); + var resumido = (bool)Report.GetParameterValue("IsResumido"); + ghbProdutosUmaLinha.Visible = oneLine && !resumido; + dbProdutosUmaLinha.Visible = oneLine && !resumido; + } + + private void dbProdutosUmaLinha_BeforePrint(object sender, EventArgs e) + { + var imprimeDesconto = dbProdutosUmaLinha.Visible && (Decimal)Report.GetColumnValue("CFe.InfCFe.Det.Prod.VDesc") > 0; + var imprimeAcrescimo = dbProdutosUmaLinha.Visible && (Decimal)Report.GetColumnValue("CFe.InfCFe.Det.Prod.VOutro") > 0; + + cbDescontoItemUmaLinha.Visible = imprimeDesconto; + cbAcrescimoItemUmaLinha.Visible = imprimeAcrescimo; + + if(imprimeDesconto && imprimeAcrescimo) + { + cbAcrescimoItemUmaLinha.Border.Lines = BorderLines.None; + } + + if(imprimeDesconto || imprimeAcrescimo) + { + dbProdutosUmaLinha.Border.Lines = BorderLines.None; + } + else + { + dbProdutosUmaLinha.Border.Lines = BorderLines.Bottom; + } + } + + private void ghbProdutosDuasLinhas_BeforePrint(object sender, EventArgs e) + { + var oneLine = (bool)Report.GetParameterValue("IsOneLine"); + var resumido = (bool)Report.GetParameterValue("IsResumido"); + + ghbProdutosDuasLinhas.Visible = !oneLine && !resumido; + dbProdutosDuasLinhas.Visible = !oneLine && !resumido; + } + + private void dbProdutosDuasLinhas_BeforePrint(object sender, EventArgs e) + { + var imprimeDesconto = dbProdutosDuasLinhas.Visible && (Decimal)Report.GetColumnValue("CFe.InfCFe.Det.Prod.VDesc") > 0; + var imprimeAcrescimo = dbProdutosDuasLinhas.Visible && (Decimal)Report.GetColumnValue("CFe.InfCFe.Det.Prod.VOutro") > 0; + + cbDescontoItemDuasLinhas.Visible = imprimeDesconto; + cbAcrescimoItemDuasLinhas.Visible = imprimeAcrescimo; + + if(imprimeDesconto && imprimeAcrescimo) + { + cbAcrescimoItemDuasLinhas.Border.Lines = BorderLines.None; + } + + if(imprimeDesconto || imprimeAcrescimo) + { + dbProdutosDuasLinhas.Border.Lines = BorderLines.None; + } + else + { + dbProdutosDuasLinhas.Border.Lines = BorderLines.Bottom; + } + } + + private void gfbProdutos_BeforePrint(object sender, EventArgs e) + { + var acrescimo = (Decimal)Report.GetColumnValue("CFe.InfCFe.Total.ICMSTot.VOutro"); + var acrSubtotal = (Decimal)Report.GetColumnValue("CFe.InfCFe.Total.DescAcrEntr.VAcresSubtot"); + + var desconto = (Decimal)Report.GetColumnValue("CFe.InfCFe.Total.ICMSTot.VDesc"); + var descSubtotal = (Decimal)Report.GetColumnValue("CFe.InfCFe.Total.DescAcrEntr.VDescSubtot"); + + gfbProdutosAcrescimos.Visible = (acrescimo + acrSubtotal) > 0; + gfbProdutosDescontos.Visible = (desconto + descSubtotal) > 0; + } + + private void dbPagamento_BeforePrint(object sender, EventArgs e) + { + var troco = (Decimal)Report.GetColumnValue("CFe.InfCFe.Pagto.VTroco"); + dbPagamentoTroco.Visible = troco > 0; + } + + private void txtDescPagto_BeforePrint(object sender, EventArgs e) + { + var codigo = (CodigoMP)Report.GetColumnValue("CFe.InfCFe.Pagto.Pagamentos.CMp"); + txtDescPagto.Text = codigo.Descricao(); + } + + private void dbEntregaHeader_BeforePrint(object sender, EventArgs e) + { + var logradouro = (string)Report.GetColumnValue("CFe.InfCFe.Entrega.XLgr"); + dbEntregaHeader.Visible = !string.IsNullOrEmpty(logradouro); + } + + private void dbEntrega_BeforePrint(object sender, EventArgs e) + { + var logradouro = (string)Report.GetColumnValue("CFe.InfCFe.Entrega.XLgr"); + dbEntrega.Visible = !string.IsNullOrEmpty(logradouro); + } + + private void dbObsContribuenteHeader_BeforePrint(object sender, EventArgs e) + { + var infCpl = (string)Report.GetColumnValue("CFe.InfCFe.InfAdic.InfCpl"); + var lei12741 = (Decimal)Report.GetColumnValue("CFe.InfCFe.Total.VCFeLei12741"); + + dbObsContribuenteHeader.Visible = !string.IsNullOrEmpty(infCpl) || lei12741 > 0; + } + + private void dbObsContribuente_BeforePrint(object sender, EventArgs e) + { + var infCpl = (string)Report.GetColumnValue("CFe.InfCFe.InfAdic.InfCpl"); + dbObsContribuente.Visible = !string.IsNullOrEmpty(infCpl); + + var lei12741 = (Decimal)Report.GetColumnValue("CFe.InfCFe.Total.VCFeLei12741"); + dbObsContribuenteFooter.Visible = lei12741 > 0; + + dbObsContribuenteHeader.Visible = dbObsContribuente.Visible || dbObsContribuenteFooter.Visible; + } + + private void dbQrCode_BeforePrint(object sender, EventArgs e) + { + var documentoDest = ""; + var id = (string)Report.GetColumnValue("CFe.InfCFe.Id"); + var cnpj = (string)Report.GetColumnValue("CFe.InfCFe.Dest.CNPJ"); + var cpf = (string)Report.GetColumnValue("CFe.InfCFe.Dest.CPF"); + var dtEmissao = (DateTime)Report.GetColumnValue("CFe.InfCFe.Ide.DhEmissao"); + var valor = (Decimal)Report.GetColumnValue("CFe.InfCFe.Total.VCFe"); + var qrCode = (string)Report.GetColumnValue("CFe.InfCFe.Ide.AssinaturaQrcode"); + var espacoFinal = (float)Report.GetParameterValue("EspacoFinal"); + var chave = id.OnlyNumbers(); + + TextChaveAcesso.Text = Regex.Replace(chave, ".{4}", "$0 "); + BarcodeChaveAcesso1.Text = chave.Substring(0, 22); + BarcodeChaveAcesso2.Text = chave.Substring(22, 22); + + if (!string.IsNullOrEmpty(cnpj)) + { + documentoDest = cnpj.OnlyNumbers(); + } + else + { + documentoDest = cpf.OnlyNumbers(); + } + + bcoQrCode.Text = String.Format("{0}|{1:yyyyMMddHHmmss}|{2:0.00}|{3}|{4}", chave, dtEmissao, valor, documentoDest, qrCode); + + if(espacoFinal > 0) + { + dbQrCode.Height += espacoFinal; + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/Extrato/ExtratoSatCancelamento.frx b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/Extrato/ExtratoSatCancelamento.frx new file mode 100644 index 0000000..d187654 --- /dev/null +++ b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/Extrato/ExtratoSatCancelamento.frx @@ -0,0 +1,241 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using System.Text.RegularExpressions; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; +using ACBr.Net.Core.Extensions; +using ACBr.Net.DFe.Core.Common; +using ACBr.Net.Sat; +using ACBr.Net.Sat.Extrato.FastReport.OpenSource; + +namespace FastReport +{ + public class ReportScript + { + private void rtbTitulo_BeforePrint(object sender, EventArgs e) + { + var imagem = (byte[])(Report.GetParameterValue("Logo") ?? new byte[0]); + if(imagem.Length < 1) + { + rtbTitulo.Height = 10f; + poEmitLogo.Visible = false; + return; + } + + poEmitLogo.SetImageData(imagem); + } + + private void TextNumeroExtrato_BeforePrint(object sender, EventArgs e) + { + var ambiente = (DFeTipoAmbiente)Report.GetParameterValue("Ambiente"); + var numeroCFe = (int)Report.GetColumnValue("CFeCanc.InfCFe.Ide.NCFe"); + TextNumeroExtrato.Text = "Extrato Nº " + (ambiente == DFeTipoAmbiente.Homologacao ? "000000" : numeroCFe.ToString()); + } + + private void TextClienteCPFCNPJ_BeforePrint(object sender, EventArgs e) + { + var documentoDest = "CPF/CNPJ do Consumidor : "; + var cnpj = (string)Report.GetColumnValue("CFeCanc.InfCFe.Dest.CNPJ"); + var cpf = (string)Report.GetColumnValue("CFeCanc.InfCFe.Dest.CPF"); + + TextClienteCPFCNPJ.Text = ""; + + if (!string.IsNullOrEmpty(cnpj)) + { + if(cnpj.OnlyNumbers() == "00000000000000") return; + + TextClienteCPFCNPJ.Text = documentoDest + cnpj.FormataCNPJ(); + } + else + { + if(cpf.OnlyNumbers() == "00000000000") return; + + TextClienteCPFCNPJ.Text = documentoDest + cpf.FormataCPF(); + } + } + + private void phbEmitenteTeste_BeforePrint(object sender, EventArgs e) + { + var ambiente = (DFeTipoAmbiente)Report.GetParameterValue("Ambiente"); + phbEmitenteTeste.Visible = ambiente == DFeTipoAmbiente.Homologacao; + } + + private void dbQrCode_BeforePrint(object sender, EventArgs e) + { + var documentoDest = ""; + var id = (string)Report.GetColumnValue("CFeCanc.InfCFe.ChCanc"); + var cnpj = (string)Report.GetColumnValue("CFeCanc.InfCFe.Dest.CNPJ"); + var cpf = (string)Report.GetColumnValue("CFeCanc.InfCFe.Dest.CPF"); + var dtEmissao = (DateTime)Report.GetColumnValue("CFeCanc.InfCFe.Ide.DhEmissao"); + var valor = (Decimal)Report.GetColumnValue("CFeCanc.InfCFe.Total.VCFe"); + var qrCode = (string)Report.GetColumnValue("CFeCanc.InfCFe.Ide.AssinaturaQrcode"); + var chave = id.OnlyNumbers(); + + + + TextChaveAcesso.Text = Regex.Replace(chave, ".{4}", "$0 "); + BarcodeChaveAcesso1.Text = chave.Substring(0, 22); + BarcodeChaveAcesso2.Text = chave.Substring(22, 22); + + if (!string.IsNullOrEmpty(cnpj)) + { + documentoDest = cnpj.OnlyNumbers(); + } + else + { + documentoDest = cpf.OnlyNumbers(); + } + + bcoQrCode.Text = String.Format("{0}|{1:yyyyMMddHHmmss}|{2:0.00}|{3}|{4}", chave, dtEmissao, valor, documentoDest, qrCode); + } + + private void dbQrCodeCancelado_BeforePrint(object sender, EventArgs e) + { + var documentoDest = ""; + var id = (string)Report.GetColumnValue("CFeCanc.InfCFe.Id"); + var cnpj = (string)Report.GetColumnValue("CFeCanc.InfCFe.Dest.CNPJ"); + var cpf = (string)Report.GetColumnValue("CFeCanc.InfCFe.Dest.CPF"); + var dtEmissao = (DateTime)Report.GetColumnValue("CFeCanc.InfCFe.Ide.DhEmissao"); + var valor = (Decimal)Report.GetColumnValue("CFeCanc.InfCFe.Total.VCFe"); + var qrCode = (string)Report.GetColumnValue("CFeCanc.InfCFe.Ide.AssinaturaQrcode"); + var espacoFinal = (float)Report.GetParameterValue("EspacoFinal"); + var chave = id.OnlyNumbers(); + + TextChaveAcessoCancelamento.Text = Regex.Replace(chave, ".{4}", "$0 "); + BarcodeChaveAcessoCancelamento1.Text = chave.Substring(0, 22); + BarcodeChaveAcessoCancelamento2.Text = chave.Substring(22, 22); + + if (!string.IsNullOrEmpty(cnpj)) + { + documentoDest = cnpj.OnlyNumbers(); + } + else + { + documentoDest = cpf.OnlyNumbers(); + } + + bcoQrCodeCancelamento.Text = String.Format("{0}|{1:yyyyMMddHHmmss}|{2:0.00}|{3}|{4}", chave, dtEmissao, valor, documentoDest, qrCode); + + if(espacoFinal > 0) + { + dbQrCodeCancelado.Height += espacoFinal; + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/ExtratoEventArgs.cs b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/ExtratoEventArgs.cs new file mode 100644 index 0000000..3bf660b --- /dev/null +++ b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/ExtratoEventArgs.cs @@ -0,0 +1,33 @@ +using System; + +namespace ACBr.Net.Sat.Extrato.FastReport.OpenSource +{ + public class ExtratoEventArgs : EventArgs + { + #region Constructors + + public ExtratoEventArgs(ExtratoLayOut tipo) + { + Tipo = tipo; + FilePath = string.Empty; + } + + #endregion Constructors + + #region Propriedades + + /// + /// Retorna o tipo de arquivo necessario. + /// + /// The tipo. + public ExtratoLayOut Tipo { get; internal set; } + + /// + /// Define ou retorna o caminho para o arquivo do FastReport. + /// + /// The file path. + public string FilePath { get; set; } + + #endregion Propriedades + } +} \ No newline at end of file diff --git a/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/ExtratoFastReport.cs b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/ExtratoFastReport.cs new file mode 100644 index 0000000..0123dd0 --- /dev/null +++ b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/ExtratoFastReport.cs @@ -0,0 +1,200 @@ +// *********************************************************************** +// Assembly : ACBr.Net.Sat.Extrato.FastReport +// Author : RFTD +// Created : 06-28-2016 +// +// Last Modified By : RFTD +// Last Modified On : 10-26-2018 +// *********************************************************************** +// +// The MIT License (MIT) +// Copyright (c) 2016 Grupo ACBr.Net +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// +// *********************************************************************** + +using System; +using System.Drawing.Printing; +using System.IO; +using System.Reflection; +using ACBr.Net.Core.Extensions; +using ACBr.Net.DFe.Core.Common; +using FastReport; +using FastReport.Export.Html; +using FastReport.Export.PdfSimple; + +namespace ACBr.Net.Sat.Extrato.FastReport.OpenSource +{ + public sealed class ExtratoFastReport : ExtratoSat + { + #region Fields + + private Report internalReport; + private PrinterSettings settings; + + #endregion Fields + + #region Events + + public event EventHandler OnGetExtrato; + + #endregion Events + + #region Propriedades + + public bool DescricaoUmaLinha { get; set; } + + public decimal EspacoFinal { get; set; } + + #endregion Propriedades + + #region Methods + + public override void ImprimirExtrato(CFe cfe) + { + PrepararImpressao(ExtratoLayOut.Completo, cfe.InfCFe.Ide.TpAmb ?? DFeTipoAmbiente.Homologacao); + internalReport.RegisterData(new[] { cfe }, "CFe"); + Imprimir(); + } + + public override void ImprimirExtratoResumido(CFe cfe) + { + PrepararImpressao(ExtratoLayOut.Resumido, cfe.InfCFe.Ide.TpAmb ?? DFeTipoAmbiente.Homologacao); + internalReport.RegisterData(new[] { cfe }, "CFe"); + Imprimir(); + } + + public override void ImprimirExtratoCancelamento(CFeCanc cFeCanc, DFeTipoAmbiente ambiente) + { + PrepararImpressao(ExtratoLayOut.Cancelamento, ambiente); + internalReport.RegisterData(new[] { cFeCanc }, "CFeCanc"); + Imprimir(); + } + + private void Imprimir() + { + internalReport.Prepare(); + + switch (Filtro) + { + case FiltroDFeReport.Nenhum: + if (MostrarPreview) + internalReport.Show(); + else if (MostrarSetup) + internalReport.PrintWithDialog(); + else + internalReport.Print(settings); + break; + + case FiltroDFeReport.PDF: + var pdfExport = new PDFSimpleExport() + { + ShowProgress = MostrarSetup, + OpenAfterExport = MostrarPreview + }; + + internalReport.Export(pdfExport, NomeArquivo); + break; + + case FiltroDFeReport.HTML: + var htmlExport = new HTMLExport + { + Format = HTMLExportFormat.MessageHTML, + EmbedPictures = true, + Preview = MostrarPreview, + ShowProgress = MostrarSetup + }; + + internalReport.Export(htmlExport, NomeArquivo); + break; + + default: + throw new ArgumentOutOfRangeException(); + } + + internalReport.Dispose(); + internalReport = null; + } + + private void PrepararImpressao(ExtratoLayOut tipo, DFeTipoAmbiente ambiente) + { + internalReport = new Report(); + + var e = new ExtratoEventArgs(tipo); + OnGetExtrato.Raise(this, e); + if (e.FilePath.IsEmpty() || !File.Exists(e.FilePath)) + { + var assembly = Assembly.GetExecutingAssembly(); + + Stream ms; + switch (tipo) + { + case ExtratoLayOut.Completo: + case ExtratoLayOut.Resumido: + ms = assembly.GetManifestResourceStream("ACBr.Net.Sat.Extrato.FastReport.OpenSource.Extrato.ExtratoSat.frx"); + break; + + case ExtratoLayOut.Cancelamento: + ms = assembly.GetManifestResourceStream("ACBr.Net.Sat.Extrato.FastReport.OpenSource.Extrato.ExtratoSatCancelamento.frx"); + break; + + default: + throw new ArgumentOutOfRangeException(nameof(tipo), tipo, null); + } + + internalReport.Load(ms); + } + else + { + internalReport.Load(e.FilePath); + } + +#if NETFULL + internalReport.SetParameterValue("Logo", Logo.ToByteArray()); +#else + internalReport.SetParameterValue("Logo", Logo); +#endif + internalReport.SetParameterValue("IsResumido", tipo == ExtratoLayOut.Resumido); + internalReport.SetParameterValue("IsOneLine", DescricaoUmaLinha); + internalReport.SetParameterValue("EspacoFinal", EspacoFinal); + internalReport.SetParameterValue("Ambiente", ambiente); + + settings = new PrinterSettings { Copies = (short)Math.Max(NumeroCopias, 1) }; + + if (!Impressora.IsEmpty()) + settings.PrinterName = Impressora; + } + + #endregion Methods + + #region Overrides + + protected override void OnInitialize() + { + // + } + + protected override void OnDisposing() + { + // + } + + #endregion Overrides + } +} \ No newline at end of file diff --git a/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/FastReportExtensions.cs b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/FastReportExtensions.cs new file mode 100644 index 0000000..71941ae --- /dev/null +++ b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/FastReportExtensions.cs @@ -0,0 +1,158 @@ +// *********************************************************************** +// Assembly : ACBr.Net.NFSe.DANFSe.FastReport.OpenSource +// Author : Rafael Dias +// Created : 01-31-2016 +// +// Last Modified By : Rafael Dias +// Last Modified On : 07-05-2018 +// *********************************************************************** +// +// The MIT License (MIT) +// Copyright (c) 2016 Grupo ACBr.Net +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// +// *********************************************************************** + +using System.Drawing; +using System.Drawing.Printing; +using System.IO; +using System.Windows.Forms; +using FastReport; +using FastReport.Export; +using FastReport.Export.Image; +using FastReport.Utils; + +#if !NETFULL +using ACBr.Net.DFe.Core; +#endif + +namespace ACBr.Net.Sat.Extrato.FastReport.OpenSource +{ + internal static class FastReportExtensions + { + #region Fields + + private const float scaleFactor = 300 / 96f; + + #endregion Fields + + #region Methods + + public static void PrintWithDialog(this Report report) + { +#if NETFULL + using (var dlg = new PrintDialog()) + { + dlg.AllowSomePages = true; + dlg.AllowSelection = true; + dlg.UseEXDialog = true; + + if (dlg.ShowDialog() != DialogResult.OK) return; + + report.Print(dlg.PrinterSettings); + } +#else + throw new ACBrDFeException("Metodo não suportado nesta plataforma."); +#endif + } + + public static void Print(this Report report, PrinterSettings settings = null) + { + var doc = report.PrepareDoc(settings); + if (doc == null) return; + + doc.Print(); + doc.Dispose(); + } + + public static void Show(this Report report, PrinterSettings settings = null) + { +#if NETFULL + var doc = report.PrepareDoc(settings); + if (doc == null) return; + + using (var preview = new PrintPreviewDialog() + { + Document = doc, + StartPosition = FormStartPosition.CenterScreen, + WindowState = FormWindowState.Maximized + }) + preview.ShowDialog(); + + doc.Dispose(); +#else + throw new ACBrDFeException("Metodo não suportado nesta plataforma."); +#endif + } + + private static PrintDocument PrepareDoc(this Report report, PrinterSettings settings = null) + { + if (report.PreparedPages.Count < 1) + { + report.Prepare(); + if (report.PreparedPages.Count < 1) return null; + } + + var page = 0; + var exp = new ImageExport { ImageFormat = ImageExportFormat.Png, Resolution = 600 }; + + var doc = new PrintDocument { DocumentName = report.Name }; + + if (settings != null) + doc.PrinterSettings = settings; + + // Ajustando o tamanho da pagina + doc.QueryPageSettings += (sender, args) => + { + var rPage = report.PreparedPages.GetPage(page); + args.PageSettings.Landscape = rPage.Landscape; + args.PageSettings.Margins = new Margins((int)(scaleFactor * rPage.LeftMargin * Units.HundrethsOfInch), + (int)(scaleFactor * rPage.RightMargin * Units.HundrethsOfInch), + (int)(scaleFactor * rPage.TopMargin * Units.HundrethsOfInch), + (int)(scaleFactor * rPage.BottomMargin * Units.HundrethsOfInch)); + + args.PageSettings.PaperSize = new PaperSize("Custom", (int)(ExportUtils.GetPageWidth(rPage) * scaleFactor * Units.HundrethsOfInch), + (int)(ExportUtils.GetPageHeight(rPage) * scaleFactor * Units.HundrethsOfInch)); + }; + + doc.PrintPage += (sender, args) => + { + using (var ms = new MemoryStream()) + { + exp.PageRange = PageRange.PageNumbers; + exp.PageNumbers = $"{page + 1}"; + exp.Export(report, ms); + + args.Graphics.DrawImage(Image.FromStream(ms), args.PageBounds); + } + + page++; + + args.HasMorePages = page < report.PreparedPages.Count; + }; + + doc.EndPrint += (sender, args) => page = 0; + doc.Disposed += (sender, args) => exp?.Dispose(); + + return doc; + } + + #endregion Methods + } +} \ No newline at end of file diff --git a/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/acbr.net.snk b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/acbr.net.snk new file mode 100644 index 0000000..7fbd538 Binary files /dev/null and b/src/ACBr.Net.Sat.Extrato.FastReport.OpenSource/acbr.net.snk differ diff --git a/src/ACBr.Net.Sat.sln b/src/ACBr.Net.Sat.sln index d19209d..3315374 100644 --- a/src/ACBr.Net.Sat.sln +++ b/src/ACBr.Net.Sat.sln @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ACBr.Net.Sat", "ACBr.Net.Sa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACBr.Net.Sat.Demo", "ACBr.Net.Sat.Demo\ACBr.Net.Sat.Demo.csproj", "{D0D31D3B-C7D4-45F3-B09F-618FF56A48B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACBr.Net.Sat.Extrato.FastReport.OpenSource", "ACBr.Net.Sat.Extrato.FastReport.OpenSource\ACBr.Net.Sat.Extrato.FastReport.OpenSource.csproj", "{7E78F7EB-71C8-4BA6-AD2A-80EE10EE2D99}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {D0D31D3B-C7D4-45F3-B09F-618FF56A48B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {D0D31D3B-C7D4-45F3-B09F-618FF56A48B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0D31D3B-C7D4-45F3-B09F-618FF56A48B8}.Release|Any CPU.Build.0 = Release|Any CPU + {7E78F7EB-71C8-4BA6-AD2A-80EE10EE2D99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E78F7EB-71C8-4BA6-AD2A-80EE10EE2D99}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E78F7EB-71C8-4BA6-AD2A-80EE10EE2D99}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E78F7EB-71C8-4BA6-AD2A-80EE10EE2D99}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ACBr.Net.Sat/ACBr.Net.Sat.csproj b/src/ACBr.Net.Sat/ACBr.Net.Sat.csproj index 550dd63..2c97208 100644 --- a/src/ACBr.Net.Sat/ACBr.Net.Sat.csproj +++ b/src/ACBr.Net.Sat/ACBr.Net.Sat.csproj @@ -6,7 +6,7 @@ ACBr.Net.Sat true acbr.net.snk - Copyright © Grupo ACBr.Net 2014 - 2020 + Copyright © Grupo ACBr.Net 2014 - 2021 Grupo ACBr.Net Rafael Dias https://acbrnet.github.io @@ -17,10 +17,9 @@ ACBr ACBr.Net SAT CF-e-SAT Automação Comercial Biblioteca para utilização do SAT/MFe pt-BR - LICENSE 1.2.8.0 1.2.8.0 - 1.2.8.0 + 1.2.8.1 true true true @@ -56,12 +55,18 @@ - - + + + + + + + + all - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -69,7 +74,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all @@ -78,10 +83,6 @@ - - - - True diff --git a/src/ACBr.Net.Sat/ACBrSat.cs b/src/ACBr.Net.Sat/ACBrSat.cs index d126c04..abb32e4 100644 --- a/src/ACBr.Net.Sat/ACBrSat.cs +++ b/src/ACBr.Net.Sat/ACBrSat.cs @@ -550,7 +550,7 @@ public ConsultaSessaoResposta ConsultarUltimaSessaoFiscal() { Guard.Against(!Ativo, "Componente não está ativo."); - IniciaComando($"ConsultarUltimaSessaoFiscal()"); + IniciaComando("ConsultarUltimaSessaoFiscal()"); var ret = satLibrary.ConsultarUltimaSessaoFiscal(Sessao, CodigoAtivacao); return FinalizaComando(ret); @@ -742,7 +742,6 @@ public SatResposta TrocarCodigoDeAtivacao(string codigo, int opcao, string novoC /// The cfe. public void ImprimirExtrato(CFe cfe) { - Guard.Against(!Ativo, "Componente não está ativo."); Guard.Against(Extrato == null, "Componente de Impressão não definido !"); Extrato.ImprimirExtrato(cfe); @@ -754,7 +753,6 @@ public void ImprimirExtrato(CFe cfe) /// The cfe. public void ImprimirExtratoResumido(CFe cfe) { - Guard.Against(!Ativo, "Componente não está ativo."); Guard.Against(Extrato == null, "Componente de Impressão não definido !"); Extrato.ImprimirExtratoResumido(cfe); @@ -767,7 +765,6 @@ public void ImprimirExtratoResumido(CFe cfe) /// The c fe canc. public void ImprimirExtratoCancelamento(CFeCanc cFeCanc, DFeTipoAmbiente ambiente) { - Guard.Against(!Ativo, "Componente não está ativo."); Guard.Against(Extrato == null, "Componente de Impressão não definido !"); Extrato.ImprimirExtratoCancelamento(cFeCanc, ambiente); diff --git a/src/ACBr.Net.Sat/FodyWeavers.xsd b/src/ACBr.Net.Sat/FodyWeavers.xsd index 07efaaf..af4dac8 100644 --- a/src/ACBr.Net.Sat/FodyWeavers.xsd +++ b/src/ACBr.Net.Sat/FodyWeavers.xsd @@ -11,6 +11,16 @@ Used to control if the On_PropertyName_Changed feature is enabled. + + + Used to control if the Dependent properties feature is enabled. + + + + + Used to control if the IsChanged property feature is enabled. + + Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form. @@ -31,6 +41,16 @@ Used to control if equality checks should use the static Equals method resolved from the base class. + + + Used to turn off build warnings from this weaver. + + + + + Used to turn off build warnings about mismatched On_PropertyName_Changed methods. + +