Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class frmRelMultaJurosCm
	Inherits System.Windows.Forms.Form
	Private ifrmIcms As FrmRelatorio
	Private istrTamCol As String
	Private istrCabCol As String
	
	Private Sub cmdArquivo_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdArquivo.Click
		Me.dialArqOpen.DefaultExt = "CSV"
		'UPGRADE_WARNING: Filter has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
		Me.dialArqOpen.Filter = "*." & Me.dialArqOpen.DefaultExt
		Me.dialArqOpen.FileName = My.Application.Info.DirectoryPath & "\RelAcrescimo_RIT_" & VB6.Format(BuscaDataBD, "yyyymmddHHMMSS") & "." & Me.dialArqOpen.DefaultExt
		Me.dialArqOpen.Title = "Arquivo de exportação do Acréscimo Moratório (RIT)"
		Me.dialArqOpen.ShowDialog()
		Me.txtArquivo.Text = Me.dialArqOpen.FileName
	End Sub
	
	Private Sub cmdExporta_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdExporta.Click
		'Controle Arquivo
		Dim lstrLin As String
		Dim lintARQ As Short
		Dim llngRow As Integer
		Dim llngCol As Integer
		Call LigDes(False)
		'Export para CSV
		If Trim(Me.txtArquivo.Text) <> "" Then
			Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
			lintARQ = FreeFile
			FileOpen(lintARQ, Me.txtArquivo.Text, OpenMode.Output)
			With Me.mfgFaturas
				Call BarraProgresso((Me.ProgressBar), (Me.lblPerc), (Me.lblInfo), 0, .Rows - 1, " Gerando Arquivo ")
				For llngRow = 0 To .Rows - 1
					lstrLin = ""
					For llngCol = 0 To .Cols - 1
						lstrLin = lstrLin & .get_TextMatrix(llngRow, llngCol) & ";"
					Next llngCol
					PrintLine(lintARQ, lstrLin)
					Call BarraProgresso((Me.ProgressBar), (Me.lblPerc), (Me.lblInfo), 0, 1, " Gerando Arquivo ")
				Next llngRow
			End With
			Me.Cursor = System.Windows.Forms.Cursors.Default
			FileClose(lintARQ)
			Call MsgBox("Arquivo gerado com sucesso!", MsgBoxStyle.Information, gstrTituloMensagem)
		Else
			Call MsgBox("Você precisa selecionar o caminho e o arquivo para exportação!", MsgBoxStyle.Information, gstrTituloMensagem)
		End If
		Call LigDes(True)
	End Sub
	
	Private Sub cmdFechar_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdFechar.Click
		Call Me.Close()
	End Sub
	
	Private Sub frmRelMultaJurosCm_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		Select Case KeyAscii
			Case System.Windows.Forms.Keys.Return
				KeyAscii = 0
				Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
			Case System.Windows.Forms.Keys.Escape
				Call cmdFechar_Click(cmdFechar, New System.EventArgs())
		End Select
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub frmRelMultaJurosCm_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Call CenterForm(Me)
		Me.dtpIni.value = BuscaDataBD
		'UPGRADE_WARNING: Couldn't resolve default property of object Me.dtpIni.value. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		Me.dtpFim.value = Me.dtpIni.value
		ifrmIcms = New FrmRelatorio
		Call MontaGrade()
	End Sub
	
	Private Sub cmdImprimir_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdImprimir.Click
		Dim llngPosItem As Integer
		Dim llngPosInt As Integer
		Dim llngPosVir As Integer
		Dim llngPosCif As Integer
		Dim llngPosA As Integer
		Dim llngPosB As Integer
		Dim llngPosC As Integer
		
		Dim llngTam As Integer
		Dim ldblNumNf As Double
		Dim lstrMesAn As String
		Dim ldblNnfAc As Double
		Dim lstrManAc As String
		Dim ldblANnfAc As Double
		Dim lstrAManAc As String
		Dim lstrCodIt As String
		Dim lstrCodRef As String
		Dim lstrZona As String
		Dim lstrLivro As String
		Dim lstrConta As String
		Dim lstrClass As String
		Dim lstrGruTa As String
		Dim lstrGrupo As String
		
		Dim ldblMultaFornec As Double
		Dim ldblMultaTribut As Double
		Dim ldblMultaOutros As Double
		Dim ldblMultaTaxado As Double
		Dim ldblMultaDivers As Double
		
		Dim ldblJurosFornec As Double
		Dim ldblJurosTribut As Double
		Dim ldblJurosOutros As Double
		Dim ldblJurosTaxado As Double
		Dim ldblJurosDivers As Double
		
		Dim ldblCorMoFornec As Double
		Dim ldblCorMoTribut As Double
		Dim ldblCorMoOutros As Double
		Dim ldblCorMoTaxado As Double
		Dim ldblCorMoDivers As Double
		
		Dim lstrAux As String
		Dim lstrIte As String
		Dim llngIni As Integer
		Dim llngFim As Integer
		Dim lstrSql As String
		Dim lrstAux As ADODB.Recordset
		lrstAux = New ADODB.Recordset
		Call MontaGrade()
		Call LigDes(False)
		llngIni = CInt(VB6.Format(Me.dtpIni.value, "yyyyMM"))
		llngFim = CInt(VB6.Format(Me.dtpFim.value, "yyyyMM"))
		Me.lblInfo.Text = " Aguarde processamento..."
		Call Me.lblInfo.Refresh()
		Me.mfgFaturas.Redraw = False
		Me.mfgResumo.Redraw = False
		Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
		System.Windows.Forms.Application.DoEvents()
		lstrSql = ""
		lstrSql = lstrSql & "SELECT "
		lstrSql = lstrSql & "       numnf, "
		lstrSql = lstrSql & "       mesano, "
		lstrSql = lstrSql & "       mesano_ref, "
		lstrSql = lstrSql & "       cons_id, "
		lstrSql = lstrSql & "       unid_id, "
		lstrSql = lstrSql & "       zona, "
		lstrSql = lstrSql & "       livro, "
		lstrSql = lstrSql & "       conta, "
		lstrSql = lstrSql & "       itensserv, "
		lstrSql = lstrSql & "       codclas, "
		lstrSql = lstrSql & "       ta, "
		lstrSql = lstrSql & "       grupo "
		lstrSql = lstrSql & "  FROM nf "
		lstrSql = lstrSql & " WHERE mesano_ref BETWEEN " & llngIni & " AND " & llngFim & " "
		lstrSql = lstrSql & "   AND itensserv LIKE '%9080000061%' "
		lstrSql = lstrSql & " ORDER BY mesano_ref ASC"
		Call Conectar(lstrSql, lrstAux)
		With lrstAux
			If .State = ADODB.ObjectStateEnum.adStateOpen Then
				If .RecordCount > 0 Then
					Call BarraProgresso((Me.ProgressBar), (Me.lblPerc), (Me.lblInfo), 0, .RecordCount)
					While Not .EOF
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrIte = Trim(IIf(IsDbNull(.Fields("itensserv").value), "", .Fields("itensserv").value))
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrClass = Trim(IIf(IsDbNull(.Fields("codclas").value), "9101", .Fields("codclas").value))
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrGruTa = Mid(Trim(IIf(IsDbNull(.Fields("ta").value), "01B100", .Fields("ta").value)), 3, 2)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrGrupo = Trim(IIf(IsDbNull(.Fields("grupo").value), "B", .Fields("grupo").value))
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrZona = Trim(IIf(IsDbNull(.Fields("zona").value), "", .Fields("zona").value))
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrLivro = Trim(IIf(IsDbNull(.Fields("livro").value), "", .Fields("livro").value))
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrConta = Trim(IIf(IsDbNull(.Fields("conta").value), "", .Fields("conta").value))
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrMesAn = Trim(IIf(IsDbNull(.Fields("mesano").value), "", .Fields("mesano").value))
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						ldblNumNf = CDbl(IIf(IsDbNull(.Fields("numnf").value), 0, .Fields("numnf").value))
						Select Case CInt(VB.Left(lstrClass, 1))
							Case Is < 4
								lstrClass = "Industrial"
							Case Is = 4
								lstrClass = "Comercial"
							Case Is = 5
								lstrClass = "Rural"
							Case Is = 6
								If CDbl(VB.Left(lstrClass, 2)) = 61 Then
									lstrClass = "Poder Público Municipal"
								ElseIf CDbl(VB.Left(lstrClass, 2)) = 62 Then 
									lstrClass = "Poder Público Estadual"
								ElseIf CDbl(VB.Left(lstrClass, 2)) = 63 Then 
									lstrClass = "Poder Público Federal"
								ElseIf CDbl(VB.Left(lstrClass, 2)) = 64 Then 
									lstrClass = "Iluminação Pública"
								End If
							Case Is = 7
								lstrClass = "Serviço Público"
							Case Is = 8
								lstrClass = "Consumo Próprio"
							Case Is = 9
								lstrClass = "Resindencial"
							Case Else
								lstrClass = ""
						End Select
						If lstrGruTa = "AS" Then lstrClass = "Suprimento - " & lstrClass
						ldblNnfAc = 0
						lstrManAc = ""
						ldblANnfAc = 0
						lstrAManAc = ""
						llngTam = CInt(Len(Trim(lstrIte))) - 1
						For llngPosItem = 1 To llngTam
							llngPosInt = InStr(llngPosItem, Trim(lstrIte), "?")
							llngPosVir = InStr(llngPosInt, lstrIte, ";")
							llngPosCif = InStr(llngPosInt, lstrIte, "$")
							llngPosA = (llngPosInt - llngPosItem)
							llngPosB = (llngPosVir - llngPosInt) - 1
							llngPosC = (llngPosCif - llngPosInt) - 1
							If llngPosC <= 0 Then llngPosC = llngPosB
							lstrCodIt = Mid(lstrIte, llngPosItem, llngPosA)
							If llngPosCif <= llngPosVir And llngPosCif > 0 Then
								lstrCodRef = Mid(lstrIte, llngPosCif + 1, (llngPosVir - 1) - llngPosCif)
							Else
								lstrCodRef = ""
							End If
							llngPosItem = llngPosVir
							lstrAux = lstrCodRef
							If lstrCodIt = "9080000061" Then
								If CInt(Len(lstrAux)) > 0 Then
									lstrAux = Replace(Replace(Replace(Replace(lstrAux, "Fatura", ""), " ", ""), "(", ""), ")", "")
									ldblNnfAc = CDbl(VB.Left(lstrAux, CInt(Len(lstrAux) - 7)))
									lstrManAc = VB.Right(lstrAux, 7)
								End If
							End If
							If lstrCodIt = "9080000061" Then
								Call CalculaMultaJurosRit(lstrZona, lstrLivro, lstrConta, lstrManAc, ldblNnfAc, ldblMultaFornec, ldblMultaTribut, ldblMultaOutros, ldblMultaTaxado, ldblMultaDivers, ldblJurosFornec, ldblJurosTribut, ldblJurosOutros, ldblJurosTaxado, ldblJurosDivers, ldblCorMoFornec, ldblCorMoTribut, ldblCorMoOutros, ldblCorMoTaxado, ldblCorMoDivers)
								With Me.mfgFaturas
									.Rows = .Rows + 1
									.set_TextMatrix(.Rows - 1, 0, ldblNumNf)
									.set_TextMatrix(.Rows - 1, 1, lstrMesAn)
									.set_TextMatrix(.Rows - 1, 2, lstrZona)
									.set_TextMatrix(.Rows - 1, 3, lstrLivro)
									.set_TextMatrix(.Rows - 1, 4, lstrConta)
									.set_TextMatrix(.Rows - 1, 5, lstrGrupo)
									.set_TextMatrix(.Rows - 1, 6, lstrClass)
									
									.set_TextMatrix(.Rows - 1, 7, ldblNnfAc)
									.set_TextMatrix(.Rows - 1, 8, lstrManAc)
									'
									.set_TextMatrix(.Rows - 1, 9, VB6.Format(Arredondar(ldblMultaFornec, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 10, VB6.Format(Arredondar(ldblJurosFornec, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 11, VB6.Format(Arredondar(ldblCorMoFornec, 2), "#,##0.00"))
									'
									.set_TextMatrix(.Rows - 1, 12, VB6.Format(Arredondar(ldblMultaTaxado, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 13, VB6.Format(Arredondar(ldblJurosTaxado, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 14, VB6.Format(Arredondar(ldblCorMoTaxado, 2), "#,##0.00"))
									'
									.set_TextMatrix(.Rows - 1, 15, VB6.Format(Arredondar(ldblMultaTribut, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 16, VB6.Format(Arredondar(ldblJurosTribut, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 17, VB6.Format(Arredondar(ldblCorMoTribut, 2), "#,##0.00"))
									'
									.set_TextMatrix(.Rows - 1, 18, VB6.Format(Arredondar(ldblMultaDivers, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 19, VB6.Format(Arredondar(ldblJurosDivers, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 20, VB6.Format(Arredondar(ldblCorMoDivers, 2), "#,##0.00"))
									'
									.set_TextMatrix(.Rows - 1, 21, VB6.Format(Arredondar(ldblMultaOutros, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 22, VB6.Format(Arredondar(ldblJurosOutros, 2), "#,##0.00"))
									.set_TextMatrix(.Rows - 1, 23, VB6.Format(Arredondar(ldblCorMoOutros, 2), "#,##0.00"))
								End With
								Call TotalizaResumo(lstrMesAn, IIf(lstrGruTa <> "AS", (ldblMultaFornec + ldblJurosFornec + ldblCorMoFornec), 0), IIf(lstrGruTa <> "AS", (ldblMultaTaxado + ldblJurosTaxado + ldblCorMoTaxado), 0), IIf(lstrGruTa = "AS", (ldblMultaFornec + ldblJurosFornec + ldblCorMoFornec) + (ldblMultaTaxado + ldblJurosTaxado + ldblCorMoTaxado), 0))
							End If
							ldblANnfAc = ldblNnfAc
							lstrAManAc = lstrManAc
						Next llngPosItem
						Call .MoveNext()
						Call BarraProgresso((Me.ProgressBar), (Me.lblPerc), (Me.lblInfo), 1)
					End While
				End If
				Call .Close()
			End If
		End With
		Me.Cursor = System.Windows.Forms.Cursors.Default
		'UPGRADE_NOTE: Object lrstAux may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'
		lrstAux = Nothing
		Me.mfgFaturas.Redraw = True
		Me.mfgResumo.Redraw = True
		Call Imprime()
		Call LigDes(True)
	End Sub
	
	Private Sub CalculaMultaJurosRit(ByVal astrZona As String, ByVal astrLivro As String, ByVal astrConta As String, ByVal astrMesAno As String, ByVal ablnNumNF As Double, ByRef adblMultaFornec As Double, ByRef adblMultaTribut As Double, ByRef adblMultaOutros As Double, ByRef adblMultaTaxado As Double, ByRef adblMultaDivers As Double, ByRef adblJurosFornec As Double, ByRef adblJurosTribut As Double, ByRef adblJurosOutros As Double, ByRef adblJurosTaxado As Double, ByRef adblJurosDivers As Double, ByRef adblCorMoFornec As Double, ByRef adblCorMoTribut As Double, ByRef adblCorMoOutros As Double, ByRef adblCorMoTaxado As Double, ByRef adblCorMoDivers As Double)
		
		Dim ldblPerMulta As Double
		Dim ldblPerJuros As Double
		Dim ldblPerCorMo As Double
		Dim lintQtdFeriado As Short
		
		
		Dim ldblForneci As Double
		Dim ldblTributo As Double
		Dim ldblVOutros As Double
		Dim ldblTaxados As Double
		Dim ldblDiverso As Double
		Dim ldblDescontos As Double
		
		Dim lblnFeriado As Boolean
		Dim ldtePgto As Date
		Dim ldteVcto As Date
		Dim ldteLoop As Date
		Dim llngDiasAtraso As Integer
		Dim lintSemana As Short
		Dim lstrClass As String
		Dim lstrItens As String
		Dim lstrGrTar As String
		Dim lstrFlgst As String
		Dim lintMpr As Short
		Dim lstrSql As String
		Dim lrstAux As ADODB.Recordset
		lrstAux = New ADODB.Recordset
		
		
		lblnFeriado = False
		
		lstrSql = ""
		lstrSql = lstrSql & "SELECT * "
		lstrSql = lstrSql & "  FROM nf "
		lstrSql = lstrSql & " WHERE zona   = '" & astrZona & "' "
		lstrSql = lstrSql & "   AND livro  = '" & astrLivro & "' "
		lstrSql = lstrSql & "   AND conta  = '" & astrConta & "' "
		lstrSql = lstrSql & "   AND mesano = '" & astrMesAno & "' "
		lstrSql = lstrSql & "   AND numnf  =  " & ablnNumNF & " "
		Call Conectar(lstrSql, lrstAux)
		With lrstAux
			If .State = ADODB.ObjectStateEnum.adStateOpen Then
				If .RecordCount > 0 Then
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					lstrClass = Trim(IIf(IsDbNull(.Fields("codclas").value), "9101", .Fields("codclas").value))
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					lstrItens = Trim(IIf(IsDbNull(.Fields("itensserv").value), "", .Fields("itensserv").value))
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					lstrGrTar = Mid(Trim(IIf(IsDbNull(.Fields("ta").value), "01B100", .Fields("ta").value)), 3, 2)
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					lstrFlgst = Trim(IIf(IsDbNull(.Fields("flgst").value), "", .Fields("flgst").value))
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					ldtePgto = CDate(VB6.Format(IIf(IsDbNull(.Fields("datapag").value), "0000-00-00", .Fields("datapag").value), "dd/mm/yyyy"))
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					ldteVcto = CDate(VB6.Format(IIf(IsDbNull(.Fields("datavenc").value), "0000-00-00", .Fields("datavenc").value), "dd/mm/yyyy"))
					'UPGRADE_WARNING: DateDiff behavior may be different. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6B38EC3F-686D-4B2E-B5A5-9E8E7A762E32"'
					llngDiasAtraso = DateDiff(Microsoft.VisualBasic.DateInterval.Day, ldteVcto, ldtePgto)
					lintSemana = WeekDay(ldteVcto, FirstDayOfWeek.Sunday)
					ldteLoop = ldteVcto
					If lstrFlgst = "C" Then
						lintMpr = -1
					Else
						lintMpr = 1
					End If
					adblMultaFornec = 0
					adblMultaTribut = 0
					adblMultaOutros = 0
					adblMultaTaxado = 0
					adblMultaDivers = 0
					
					adblJurosFornec = 0
					adblJurosTribut = 0
					adblJurosOutros = 0
					adblJurosTaxado = 0
					adblJurosDivers = 0
					
					adblCorMoFornec = 0
					adblCorMoTribut = 0
					adblCorMoOutros = 0
					adblCorMoTaxado = 0
					adblCorMoDivers = 0
					'Pegar o itens que entram na base de acrescimo moratório ver 911
					ldblForneci = 0
					ldblTributo = 0
					ldblVOutros = 0
					ldblTaxados = 0
					ldblDiverso = 0
					ldblDescontos = 0
					If lstrGrTar = "AS" Or lstrGrTar = "A4" Or VB.Left(lstrGrTar, 1) = "B" Then
						If VB.Left(lstrGrTar, 1) <> "B" Then
							ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020009") * lintMpr) 'Consumo Faturado
						Else
							ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "030202009") * lintMpr) 'Consumo Faturado
						End If
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020015") * lintMpr) 'Demanda
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020018") * lintMpr) 'Demanda de ultrapassagem Convencional
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020012") * lintMpr) 'Consumo Reativo
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020031") * lintMpr) 'Demanda Reativo
					ElseIf lstrGrTar = "AA" Or lstrGrTar = "AV" Or lstrGrTar = "AL" Or lstrGrTar = "AP" Then 
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020010") * lintMpr) 'Consumo faturado p
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020011") * lintMpr) 'Consumo faturado fp
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020041") * lintMpr) 'Valor Consumo devolvido na p
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020042") * lintMpr) 'Valor Consumo devolvido na fp
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020043") * lintMpr) 'Valor Consumo ultrapassado na p
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020044") * lintMpr) 'Valor Consumo ultrapassado na fp
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020021") * lintMpr) 'Demanda p
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020023") * lintMpr) '+ (BuscaVlrItem(lstrItens, "0302020072") * lintMpr) 'Demanda fp
						If lstrGrTar = "AL" Then
							ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302060021") * lintMpr) 'dif.Demanda p
							ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302060025") * lintMpr) 'dif.Demanda fp
							ldblForneci = ldblForneci - (BuscaVlrItem(lstrItens, "0302020051") * lintMpr) 'Desconto Provisorio
							ldblForneci = ldblForneci - (BuscaVlrItem(lstrItens, "0302020052") * lintMpr) 'Desconto real
							ldblForneci = ldblForneci - (BuscaVlrItem(lstrItens, "0302020053") * lintMpr) 'diferença a devolver
							ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020054") * lintMpr) 'diferença a cobrar
							ldblForneci = ldblForneci - (BuscaVlrItem(lstrItens, "0302020055") * lintMpr) 'Desconto Provisorio
							ldblForneci = ldblForneci - (BuscaVlrItem(lstrItens, "0302020056") * lintMpr) 'Desconto real
							ldblForneci = ldblForneci - (BuscaVlrItem(lstrItens, "0302020057") * lintMpr) 'diferença a devolver
							ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020058") * lintMpr) 'diferença a cobrar
						End If
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020022") * lintMpr) 'Demanda de ultrapassagem p
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020026") * lintMpr) 'Demanda de ultrapassagem fp
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020013") * lintMpr) 'Consumo Reativo p
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020014") * lintMpr) 'Consumo Reativo fp
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020027") * lintMpr) 'Demanda Reativo p
						ldblForneci = ldblForneci + (BuscaVlrItem(lstrItens, "0302020028") * lintMpr) 'Demanda Reativo fp
					End If
					ldblTributo = ldblTributo + (BuscaVlrItem(lstrItens, "0302030009") * lintMpr) 'Vlr Icms.
					ldblTributo = ldblTributo + (BuscaVlrItem(lstrItens, "0302030010") * lintMpr) 'Vlr Icms.
					ldblTributo = ldblTributo + (BuscaVlrItem(lstrItens, "0302020029") * lintMpr) 'Vlr PIS.
					ldblTributo = ldblTributo + (BuscaVlrItem(lstrItens, "0302020030") * lintMpr) 'Vlr COFINS.
					'
					ldblVOutros = ldblVOutros + (BuscaVlrItem(lstrItens, "0302990041") * lintMpr) 'ARREDONDAMENTO
					ldblVOutros = ldblVOutros + (BuscaVlrItem(lstrItens, "0302050002") * lintMpr) 'Juros verificar ainda com o calculo.
					ldblVOutros = ldblVOutros + (BuscaVlrItem(lstrItens, "0302070002") * lintMpr) 'Encargos confirma ainda com o calculo
					ldblVOutros = ldblVOutros + (BuscaVlrItem(lstrItens, "0302020032") * lintMpr) 'EUSD - Must das usinas (EFLUL)
					'
					'Busca valor de Taxas, Diversos e Convenios
					For IndCodServ = 1 To CInt(Len(Trim(lstrItens))) - 1
						Call BuscaCodItem(IndCodServ, lstrItens)
						'taxados
						If Mid(codserv, 1, 4) = "9040" Or Mid(codserv, 1, 4) = "9050" Then
							ldblTaxados = ldblTaxados + Val(VlrCodServ)
						End If
						'diversos
						If Mid(codserv, 1, 4) = "9080" And Not (Mid(codserv, 1, 10) = "9080000061" Or Mid(codserv, 1, 10) = "9080000066" Or Mid(codserv, 1, 10) = "9080000067") Then
							ldblDiverso = ldblDiverso + Val(VlrCodServ)
						End If
						'Devoluções
						If Mid(codserv, 1, 4) = "9070" And Mid(codserv, 1, 10) <> "9070000088" Then
							ldblDescontos = ldblDescontos + Val(VlrCodServ)
						End If
					Next IndCodServ
					ldblDiverso = ldblDiverso - ldblDescontos
					'Calculo da qtde de feriados
					lintQtdFeriado = 0
					While ldteLoop <= ldtePgto
						If VerificaFeriado(ldteLoop) Then
							lintQtdFeriado = lintQtdFeriado + 1
						End If
						ldteLoop = System.Date.FromOADate(ldteLoop.ToOADate + 1)
					End While
					llngDiasAtraso = llngDiasAtraso - lintQtdFeriado
					lblnFeriado = VerificaFeriado(ldteVcto)
					'Verifica se é Sábado, Domingo e Feriado se for entao nao cobra multa e juro
					If (llngDiasAtraso < 3 And lintSemana = 7) Or (llngDiasAtraso < 2 And lintSemana = 1) Or (llngDiasAtraso < 4 And lblnFeriado) Then
						'
						adblJurosFornec = 0
						adblJurosTribut = 0
						adblJurosOutros = 0
						adblJurosTaxado = 0
						adblJurosDivers = 0
						'
						adblCorMoFornec = 0
						adblCorMoTribut = 0
						adblCorMoOutros = 0
						adblCorMoTaxado = 0
						adblCorMoDivers = 0
					Else
						If llngDiasAtraso > 0 Then
							'calculando juros de acordo com a config
							ldblPerJuros = CDbl(LeConfig("PERCENTUALJUROS")) / 100
							adblJurosFornec = Arredondar(((ldblForneci * ldblPerJuros) / 365) * llngDiasAtraso, 2)
							adblJurosTribut = Arredondar(((ldblTributo * ldblPerJuros) / 365) * llngDiasAtraso, 2)
							adblJurosOutros = Arredondar(((ldblVOutros * ldblPerJuros) / 365) * llngDiasAtraso, 2)
							adblJurosTaxado = Arredondar(((ldblTaxados * ldblPerJuros) / 365) * llngDiasAtraso, 2)
							adblJurosDivers = Arredondar(((ldblDiverso * ldblPerJuros) / 365) * llngDiasAtraso, 2)
							'calculando correcao monetaria diaria
							ldteLoop = ldteVcto
							While ldteLoop <= ldtePgto
								ldblPerCorMo = IndiceCMDia(CShort(VB6.Format(ldteLoop, "mm")), CShort(VB6.Format(ldteLoop, "yyyy")))
								adblCorMoFornec = adblCorMoFornec + Arredondar(ldblForneci * ldblPerCorMo, 2)
								adblCorMoTribut = adblCorMoTribut + Arredondar(ldblTributo * ldblPerCorMo, 2)
								adblCorMoOutros = adblCorMoOutros + Arredondar(ldblVOutros * ldblPerCorMo, 2)
								adblCorMoTaxado = adblCorMoTaxado + Arredondar(ldblTaxados * ldblPerCorMo, 2)
								adblCorMoDivers = adblCorMoDivers + Arredondar(ldblDiverso * ldblPerCorMo, 2)
								ldteLoop = System.Date.FromOADate(ldteLoop.ToOADate + 1)
							End While
						End If
					End If
					ldblPerMulta = CDbl(LeConfig("MULTA")) / 100
					adblMultaFornec = Arredondar(ldblForneci * ldblPerMulta, 2)
					adblMultaTribut = Arredondar(ldblTributo * ldblPerMulta, 2)
					adblMultaOutros = Arredondar(ldblVOutros * ldblPerMulta, 2)
					adblMultaTaxado = Arredondar(ldblTaxados * ldblPerMulta, 2)
					adblMultaDivers = Arredondar(ldblDiverso * ldblPerMulta, 2)
				End If
				Call .Close()
			End If
		End With
		'UPGRADE_NOTE: Object lrstAux may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'
		lrstAux = Nothing
	End Sub
	
	Private Sub MontaGrade()
		With Me.mfgFaturas
			Call .Clear()
			.Rows = 1
			.set_TextMatrix(0, 0, "Fatura")
			.set_ColWidth(0, 1000)
			.set_ColAlignment(0, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 1, "Mês/Ano")
			.set_ColWidth(1, 750)
			.set_ColAlignment(1, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_TextMatrix(0, 2, "Zona")
			.set_ColWidth(2, 550)
			.set_ColAlignment(2, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_TextMatrix(0, 3, "Livro")
			.set_ColWidth(3, 450)
			.set_ColAlignment(3, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_TextMatrix(0, 4, "Conta")
			.set_ColWidth(4, 700)
			.set_ColAlignment(4, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_TextMatrix(0, 5, "Grupo")
			.set_ColWidth(5, 550)
			.set_ColAlignment(5, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_TextMatrix(0, 6, "Classe")
			.set_ColWidth(6, 1500)
			.set_ColAlignment(6, MSFlexGridLib.AlignmentSettings.flexAlignLeftCenter)
			.set_TextMatrix(0, 7, "Fat.Enc.Fin.")
			.set_ColWidth(7, 1000)
			.set_ColAlignment(7, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 8, "Mês.E.F.")
			.set_ColWidth(8, 750)
			.set_ColAlignment(8, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_TextMatrix(0, 9, "Multa Fornec.")
			.set_ColWidth(9, 1200)
			.set_ColAlignment(9, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 10, "Juros Fornec.")
			.set_ColWidth(10, 1200)
			.set_ColAlignment(10, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 11, "C.M. Fornec.")
			.set_ColWidth(11, 1200)
			.set_ColAlignment(11, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 12, "Multa Taxados")
			.set_ColWidth(12, 1200)
			.set_ColAlignment(12, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 13, "Juros Taxados")
			.set_ColWidth(13, 1200)
			.set_ColAlignment(13, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 14, "C.M. Taxados")
			.set_ColWidth(14, 1200)
			.set_ColAlignment(14, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 15, "Multa Tributo")
			.set_ColWidth(15, 1200)
			.set_ColAlignment(15, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 16, "Juros Tributo")
			.set_ColWidth(16, 1200)
			.set_ColAlignment(16, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 17, "C.M. Tributo")
			.set_ColWidth(17, 1200)
			.set_ColAlignment(17, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 18, "Multa Diversos")
			.set_ColWidth(18, 1200)
			.set_ColAlignment(18, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 19, "Juros Diversos")
			.set_ColWidth(19, 1200)
			.set_ColAlignment(19, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 20, "C.M. Diversos")
			.set_ColWidth(20, 1200)
			.set_ColAlignment(20, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 21, "Multa Outros")
			.set_ColWidth(21, 1200)
			.set_ColAlignment(21, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 22, "Juros Outros")
			.set_ColWidth(22, 1200)
			.set_ColAlignment(22, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 23, "C.M. Outros")
			.set_ColWidth(23, 1200)
			.set_ColAlignment(23, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
		End With
		With Me.mfgResumo
			Call .Clear()
			.Rows = 1
			.set_TextMatrix(0, 0, "Competência")
			.set_ColWidth(0, 1200)
			.set_ColAlignment(0, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_TextMatrix(0, 1, "Fornecimento e Uso da Rede")
			.set_ColWidth(1, 2200)
			.set_ColAlignment(1, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 2, "Serviço Taxado")
			.set_ColWidth(2, 1500)
			.set_ColAlignment(2, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 3, "Suprimento")
			.set_ColWidth(3, 1500)
			.set_ColAlignment(3, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 4, "Total")
			.set_ColWidth(4, 1500)
			.set_ColAlignment(4, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
		End With
		
	End Sub
	
	Private Sub TotalizaResumo(ByVal astrMesAno As String, ByVal adblFornecimento As Double, ByVal adblServicosTaxados As Double, ByVal adblSuprimento As Double)
		Dim llngRow As Integer
		Dim llngPos As Integer
		llngPos = 0
		With Me.mfgResumo
			For llngRow = 1 To .Rows - 1
				If .get_TextMatrix(llngRow, 0) = astrMesAno Then
					llngPos = llngRow
					llngRow = .Rows - 1
				End If
			Next llngRow
			If llngPos = 0 Then
				.Rows = .Rows + 1
				llngPos = (.Rows - 1)
				.set_TextMatrix(llngPos, 0, astrMesAno) 'Grupo Classe
			End If
			.set_TextMatrix(llngPos, 1, VB6.Format(CDbl(IIf(IsNumeric(.get_TextMatrix(llngPos, 1)), .get_TextMatrix(llngPos, 1), 0)) + adblFornecimento, "#,##0.00"))
			.set_TextMatrix(llngPos, 2, VB6.Format(CDbl(IIf(IsNumeric(.get_TextMatrix(llngPos, 2)), .get_TextMatrix(llngPos, 2), 0)) + adblServicosTaxados, "#,##0.00"))
			.set_TextMatrix(llngPos, 3, VB6.Format(CDbl(IIf(IsNumeric(.get_TextMatrix(llngPos, 3)), .get_TextMatrix(llngPos, 3), 0)) + adblSuprimento, "#,##0.00"))
			.set_TextMatrix(llngPos, 4, VB6.Format(CDbl(IIf(IsNumeric(.get_TextMatrix(llngPos, 4)), .get_TextMatrix(llngPos, 4), 0)) + adblFornecimento + adblServicosTaxados + adblSuprimento, "#,##0.00"))
		End With
	End Sub
	
	Private Sub Imprime()
		Dim lstrTab As String
		Dim llngRow As Integer
		istrTamCol = "<5mm|^35mm|>20mm|>20mm|>20mm|>20mm|>20mm;"
		istrCabCol = "<5mm|^35mm|^20mm|^20mm|^20mm|^20mm|^20mm;"
		With ifrmIcms
			.quem_chama = Me
			.VS.Font = VB6.FontChangeName(.VS.Font, "Arial")
			.VS.TableBorder = VSVIEW6.TableBorderSettings.tbNone
			.VS.PageBorder = VSVIEW6.TableBorderSettings.tbNone
			.VS.ShowGuides = VSVIEW6.ShowGuideSettings.gdShow
			.VS.Orientation = VSVIEW6.OrientationSettings.orPortrait
			.VS.PhysicalPage = True
			.VS.PaperSize = VSVIEW6.PaperSizeSettings.pprA4
			.VS.MarginTop = "7mm"
			.VS.MarginRight = "7mm"
			.VS.MarginLeft = "7mm"
			.VS.MarginBottom = "5mm"
			.VS.MarginFooter = "0mm"
			.VS.MarginHeader = "0mm"
			.VS.TextColor = System.Drawing.Color.Black
			.VS.BrushStyle = VSVIEW6.BrushStyleSettings.bsSolid
			.VS.Font = VB6.FontChangeBold(.VS.Font, False)
			.VS.StartDoc()
		End With
		With Me.mfgResumo
			lstrTab = ""
			lstrTab = lstrTab & .get_TextMatrix(0, 0) & "|"
			lstrTab = lstrTab & .get_TextMatrix(0, 1) & "|"
			lstrTab = lstrTab & .get_TextMatrix(0, 2) & "|"
			lstrTab = lstrTab & .get_TextMatrix(0, 3) & "|"
			lstrTab = lstrTab & .get_TextMatrix(0, 4)
			ifrmIcms.VS.Table = istrCabCol & "|" & lstrTab
			For llngRow = 1 To .Rows - 1
				lstrTab = ""
				lstrTab = lstrTab & .get_TextMatrix(llngRow, 0) & "|"
				lstrTab = lstrTab & .get_TextMatrix(llngRow, 1) & "|"
				lstrTab = lstrTab & .get_TextMatrix(llngRow, 2) & "|"
				lstrTab = lstrTab & .get_TextMatrix(llngRow, 3) & "|"
				lstrTab = lstrTab & .get_TextMatrix(llngRow, 4)
				ifrmIcms.VS.Table = istrTamCol & "|" & lstrTab
			Next llngRow
		End With
		With ifrmIcms
			Call .VS.EndDoc()
			Call .Show()
		End With
	End Sub
	
	Public Sub CabecaRel()
		With ifrmIcms
			Call Cabecalho_Relatorio(.VS, gstrEmpresa_Nome, "Relatório de Acréscimo Moratório (RIT)", "4", True, "Faturamento do Mês " & VB6.Format(Me.dtpIni.value, "mm/yyyy") & " até " & VB6.Format(Me.dtpFim.value, "mm/yyyy"))
			.VS.Font = VB6.FontChangeSize(.VS.Font, 7)
			Call LineFeed(.VS, 3)
			'UPGRADE_ISSUE: VBControlExtender method ifrmIcms.VS.CurrentY was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
			.VS.CurrentY = .VS.CurrentY + 200
		End With
	End Sub
	
	Private Sub LigDes(ByVal ablnModo As Boolean)
		Me.cmdArquivo.Enabled = ablnModo
		Me.cmdExporta.Enabled = ablnModo
		Me.cmdFechar.Enabled = ablnModo
		Me.cmdImprimir.Enabled = ablnModo
		Me.dtpIni.Enabled = ablnModo
		Me.dtpFim.Enabled = ablnModo
	End Sub
End Class