Skip to content
12 changes: 12 additions & 0 deletions DFe.Utils/DataHora.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ public static string ParaDataString(this DateTime? data)

return data == DateTime.MinValue ? null : data.Value.ToString("yyyy-MM-dd");
}

/// <summary>
/// Retorna uma string no formato AAAA-MM
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static string ParaDataAnoEMesString(this DateTime? data)
{
if (data == null) return null;

return data == DateTime.MinValue ? null : data.Value.ToString("yyyy-MM");
}

/// <summary>
/// Retorna uma string no formato AAAA-MM-DDThh:mm:ssTZD (UTC - Universal Coordinated Time)
Expand Down
3 changes: 2 additions & 1 deletion NFe.AppTeste/ConfiguracaoApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
using NFe.Danfe.Base.NFCe;
using NFe.Utils;
using NFe.Utils.Email;
using Shared.NFe.Utils.Enderecos.NovasUrlsCeara;

namespace NFe.AppTeste
{
Expand Down Expand Up @@ -84,6 +83,8 @@ public ConfiguracaoServico CfgServico
public ConfiguracaoCsc ConfiguracaoCsc { get; set; }
public ConfiguracaoDanfeNfce ConfiguracaoDanfeNfce { get; set; }

public bool EnviarTributacaoIbsCbsIs { get; set; }

/// <summary>
/// Salva os dados de CfgServico em um arquivo XML
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions NFe.AppTeste/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@
VerticalAlignment="Top" Width="178"
IsChecked="{Binding CfgServico.RemoverAcentos}"/>
</StackPanel>

<StackPanel Margin="10,10,0,0">
<CheckBox Name="CbxEnviarTributacaoDaReforma" Content="Enviar tributação IBS/CBS e IS"
HorizontalAlignment="Left"
VerticalAlignment="Top" Width="178"
Click="CbxEnviarTributacaoDaReforma_OnClick"
/>
</StackPanel>
</StackPanel>
</Grid>
</TabItem>
Expand Down
254 changes: 250 additions & 4 deletions NFe.AppTeste/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,17 @@
using NFe.Utils.Excecoes;
using NFe.Utils.Tributacao.Federal;
using Image = System.Drawing.Image;
using static System.Net.Mime.MediaTypeNames;
using System.Text;
using System.Security.Cryptography;
using NFe.Classes.Informacoes.Detalhe.Tributacao.Compartilhado;
using NFe.Classes.Informacoes.Detalhe.Tributacao.Compartilhado.InformacoesIbsCbs;
using NFe.Classes.Informacoes.Detalhe.Tributacao.Compartilhado.InformacoesIbsCbs.InformacoesCbs;
using NFe.Classes.Informacoes.Detalhe.Tributacao.Compartilhado.InformacoesIbsCbs.InformacoesIbs;
using NFe.Classes.Informacoes.Detalhe.Tributacao.Compartilhado.Tipos;
using NFe.Classes.Informacoes.Total.IbsCbs;
using NFe.Classes.Informacoes.Total.IbsCbs.Cbs;
using NFe.Classes.Informacoes.Total.IbsCbs.Ibs;
using NFe.Classes.Informacoes.Total.IbsCbs.Monofasica;

namespace NFe.AppTeste
{
Expand Down Expand Up @@ -193,6 +201,8 @@ private void CarregarConfiguracao()
}

#endregion

CbxEnviarTributacaoDaReforma.IsChecked = _configuracoes.EnviarTributacaoIbsCbsIs;
}
catch (Exception ex)
{
Expand Down Expand Up @@ -1377,7 +1387,8 @@ protected virtual ide GetIdentificacao(int numero, ModeloDocumento modelo, Versa
tpAmb = _configuracoes.CfgServico.tpAmb,
finNFe = FinalidadeNFe.fnNormal,
verProc = "3.000",
indIntermed = IndicadorIntermediador.iiSemIntermediador
indIntermed = IndicadorIntermediador.iiSemIntermediador,
// dPrevEntrega = modelo == ModeloDocumento.NFe ? DateTime.Now : null
};

if (ide.tpEmis != TipoEmissao.teNormal)
Expand Down Expand Up @@ -1541,7 +1552,184 @@ protected virtual det GetDetalhe(int i, CRT crt, ModeloDocumento modelo)

//Caso você resolva utilizar método ObterPisBasico(), comente esta proxima linha
TipoPIS = new PISOutr { CST = CSTPIS.pis99, pPIS = 0, vBC = 0, vPIS = 0 }
}
},

// Estrutura de IBS/CBS para testes durante processo de homologação
IBSCBS = _configuracoes.EnviarTributacaoIbsCbsIs ? new IBSCBS
{
CST = CST.Cst000,
cClassTrib = "000001",
// indDoacao = "1", //Somente a partir do dia 29/10
gIBSCBS = new gIBSCBS
{
vBC = 0,
gIBSUF = new gIBSUF
{
pIBSUF = 0.10m,
vIBSUF = 0,
gDif = new gDif
{
vDif = 0,
pDif = 0
},
gRed = new gRed
{
pAliqEfet = 0,
pRedAliq = 0
},
gDevTrib = new gDevTrib
{
vDevTrib = 0
}
},
gIBSMun = new gIBSMun
{
pIBSMun = 0,
vIBSMun = 0,
gDif = new gDif
{
vDif = 0,
pDif = 0
},
gRed = new gRed
{
pAliqEfet = 0,
pRedAliq = 0
},
gDevTrib = new gDevTrib
{
vDevTrib = 0
}
},
gCBS = new gCBS
{
pCBS = 0.90m,
vCBS = 0,
gDif = new gDif
{
vDif = 0,
pDif = 0
},
gRed = new gRed
{
pAliqEfet = 0,
pRedAliq = 0
},
gDevTrib = new gDevTrib
{
vDevTrib = 0
}
},
vIBS = 0,
gTribCompraGov = new gTribCompraGov
{
pAliqCBS = 0,
vTribCBS = 0,
pAliqIBSMun = 0,
vTribIBSMun = 0,
pAliqIBSUF = 0,
vTribIBSUF = 0
},
gTribRegular = new gTribRegular
{
cClassTribReg = "000001",
CSTReg = CST.Cst000,
vTribRegCBS = 0,
pAliqEfetRegCBS = 0,
vTribRegIBSMun = 0,
pAliqEfetRegIBSMun = 0,
vTribRegIBSUF = 0,
pAliqEfetRegIBSUF = 0
}
},
// gIBSCBSMono = new gIBSCBSMono
// {
// gMonoDif = new gMonoDif
// {
// pDifCBS = 0,
// pDifIBS = 0,
// vCBSMonoDif = 0,
// vIBSMonoDif = 0
// },
// gMonoPadrao = new gMonoPadrao
// {
// qBCMono = 0,
// adRemCBS = 0,
// adRemIBS = 0,
// vCBSMono = 0,
// vIBSMono = 0
// },
// gMonoRet = new gMonoRet
// {
// qBCMonoRet = 0,
// adRemCBSRet = 0,
// adRemIBSRet = 0,
// vCBSMonoRet = 0,
// vIBSMonoRet = 0
// },
// gMonoReten = new gMonoReten
// {
// qBCMonoReten = 0,
// adRemCBSReten = 0,
// adRemIBSReten = 0,
// vCBSMonoReten = 0,
// vIBSMonoReten = 0
// },
// vTotCBSMonoItem = 0,
// vTotIBSMonoItem = 0
// },
// gTransfCred = new gTransfCred
// {
// vCBS = 0,
// vIBS = 0
// },
// gAjusteCompet = new gAjusteCompet
// {
// competApur = DateTime.Now,
// vCBS = 0,
// vIBS = 0
// },
// gEstornoCred = new gEstornoCred
// {
// vCBSEstCred = 0,
// vIBSEstCred = 0
// },
// gCredPresOper = new gCredPresOper
// {
// cCredPres = "01",
// vBCCredPres = 0,
// gIBSCredPres = new gIBSCredPres
// {
// pCredPres = 0,
// vCredPres = 0,
// // vCredPresCondSus = 0 // Informar somente após 2033
// },
// gCBSCredPres = new gCBSCredPres
// {
// pCredPres = 0,
// vCredPres = 0,
// // vCredPresCondSus = 0 // Informar somente após 2027
// }
// },
// gCredPresIBSZFM = new gCredPresIBSZFM
// {
// competApur = DateTime.Now,
// tpCredPresIBSZFM = ClassificacaoCreditoPresumidoIbsZfmTipos.tpCredPresIbsZfm0,
// vCredPresIBSZFM = 0
// }
} : null,

IS = _configuracoes.EnviarTributacaoIbsCbsIs ?new IS
{
qTrib = 1,
uTrib = "PC",
pISEspec = 0,
pIS = 0,
vIS = 0,
cClassTribIS = "000001",
CSTIS = CSTIS.Is000,
vBCIS = 0
} : null
}
};

Expand Down Expand Up @@ -1593,7 +1781,10 @@ protected virtual prod GetProduto(int i)
// nCano = "123456",
// descr = "TESTE DE ARMA"
//}

// tpCredPresIBSZFM = tpCredPresIBSZFM.SemCreditoPresumido // Informado somente para testes com gCredPresIBSZFM
};

return p;
}

Expand Down Expand Up @@ -1768,7 +1959,58 @@ protected virtual total GetTotal(VersaoServico versao, List<det> produtos)
+ icmsTot.vIPI
+ icmsTot.vIPIDevol.GetValueOrDefault();

var t = new total { ICMSTot = icmsTot };
var t = new total
{
ICMSTot = icmsTot,
IBSCBSTot = _configuracoes.EnviarTributacaoIbsCbsIs ? new IBSCBSTot
{
vBCIBSCBS = 0,
gIBS = new gIBS
{
gIBSUF = new gIBSUFTotal
{
vDif = 0,
vDevTrib = 0,
vIBSUF = 0
},
gIBSMun = new gIBSMunTotal
{
vDif = 0,
vDevTrib = 0,
vIBSMun = 0
},
vIBS = 0,
vCredPres = 0,
vCredPresCondSus = 0,
},
gCBS = new gCBSTotal
{
vDif = 0,
vDevTrib = 0,
vCBS = 0,
vCredPres = 0,
vCredPresCondSus = 0
},
gMono = new gMono
{
vCBSMono = 0,
vIBSMono = 0,
vCBSMonoRet = 0,
vCBSMonoReten = 0,
vIBSMonoRet = 0,
vIBSMonoReten = 0
},
gEstornoCred = new gEstornoCredTotal
{
vCBSEstCred = 0,
vIBSEstCred = 0
}
} : null,
ISTot = _configuracoes.EnviarTributacaoIbsCbsIs ? new ISTot
{
vIS = 0,
} : null
};
return t;
}

Expand Down Expand Up @@ -2319,5 +2561,9 @@ private void BtnAtorInteressado_Click(object sender, RoutedEventArgs e)
}
}

private void CbxEnviarTributacaoDaReforma_OnClick(object sender, RoutedEventArgs e)
{
_configuracoes.EnviarTributacaoIbsCbsIs = CbxEnviarTributacaoDaReforma.IsChecked ?? false;
}
}
}
Loading