Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub OnFormat
- End Sub
- Sub OnBeforePrint
- Dim puntero, codbar, sem
- 'Semaforo para contador de paginas
- if label80.caption = "ult" then
- actpage.Text = CInt(totpage.Text)
- end if
- If CInt(totpage.Text) - CInt(actpage.Text) = 1 Then
- label80.caption = "ult"
- end if
- If CInt(actpage.Text) <> CInt(totpage.Text) Then
- 'llamada a funcion para pasar transporte
- PoneTransporte
- Else
- 'llamda a funcion para poner totales e impuestos
- PoneTotal
- End If
- codbar = appcontext.funciones.trc("punted", "campoa1", "codigo = '" & puntero & "' and clase = '" & Field8.Text & "'")
- 'codigo de barras con formato itf25_08 - Llamada a funcion MacroXLS
- label59.Caption = MacroXLS(codbar, "0")
- Barcode1.caption = GeneraCodigoBarrasCAE
- barcodetext.text = GeneraCodigoBarrasCAE
- Select Case actualcopy
- Case "1"
- label65.Caption = "ORIGINAL"
- Case "2"
- label65.Caption = "DUPLICADO"
- Case "3"
- label65.Caption = "TRIPLICADO"
- Case "4"
- label65.Caption = "CUADRUPLICADO"
- Case "5"
- label65.Caption = "QUINTUPLICADO"
- Case "6"
- label65.Caption = "SEXTUPLICADO"
- End Select
- label81.caption = "NOTA > ESTE DOCUMENTO EQUIVALE A U$S "&appcontext.funciones.formato(CDbl(netoo.text/field46.text), "#,##0.00")&" AL TIPO DE CAMBIO 1 U$s = $ "&field46.text&" (SEGUN PRESUPUESTO) DEBIENDO SER LIQUIDADO SU MPORTE EN u$S O SU EQUIVALENTE EN $ S/COTIZ BNA T/VENDEDOR AL DIA DEL VENCIMIENTO O EL DEL PAGO EFECTIVO, EL QUE FUERE MAYOR"
- if field46.text <> 1 then
- label81.visible = true
- else
- label81.visible = false
- end if
- End Sub
- Sub PoneTotal()
- Field35.text=Abs(Field35.text)
- Field36.text=Abs(Field36.text)
- Field38.text=Abs(Field38.text)
- if not(Field8.Text="A") then
- Field34.Text = cdbl(Field35.Text)
- Field33.visible = False
- Label33.visible = False
- Field37.visible = False
- Label47.visible = False
- Field32.visible = False
- Label30.visible = False
- line26.visible = False
- Line30.visible = False
- Line35.visible = False
- End if
- if not(Field8.Text="B") then
- Field32.Text = cdbl(Field35.Text) - cdbl(Field36.Text) - cdbl(Field38.Text)
- Field33.Text = cdbl(Field36.Text)
- Field34.Text = cdbl(Field35.Text)
- end if
- Field37.text = cdbl(Field38.Text)
- with appcontext.funciones
- Field32.text = .formato(Field32.text, "#,##0.00")
- Field33.text = .formato(Field33.text, "#,##0.00")
- Field34.text = .formato(Field34.text, "#,##0.00")
- Field37.text = .formato(Field37.text, "#,##0.00")
- label46.Caption = "Son:"
- Label45.Caption = appcontext.evalvalor("enletras(" & netoo.Text & ")")
- end with
- end Sub
- Sub PoneTransporte()
- 'metodo que maneja los valores del transporte en el pie
- Field32.Text = "-"
- Field33.Text = "-"
- Field34.Text = "-"
- Field37.Text = "-"
- Label45.Caption = "Transporte a la hoja Nº: " & CInt(actpage.text) + 1
- Label46.Caption = ""
- End Sub
- Function MacroXLS(DataToEncode, ReturnType)
- Dim DataToPrint
- Dim OnlyCorrectData
- Dim StringLength
- Dim i
- Dim factor
- Dim WeightedTotal
- Dim CurrentCharNum
- Dim CheckDigit
- ' Get data from user, this is the DataToEncode
- DataToEncode = RTrim(LTrim(DataToEncode))
- DataToPrint = ""
- ' Check to make sure data is numeric and remove dashes, etc.
- OnlyCorrectData = ""
- StringLength = Len(DataToEncode)
- 'Add all numbers to OnlyCorrectData str
- For i = 1 To StringLength
- If IsNumeric(Mid(DataToEncode, i, 1)) Then
- OnlyCorrectData = OnlyCorrectData & Mid(DataToEncode, i, 1)
- End If
- Next
- DataToEncode = OnlyCorrectData
- '<<<< Calculate Check Digit >>>>
- factor = 3
- WeightedTotal = 0
- For i = Len(DataToEncode) To 1 Step -1
- 'Get the value of each number starting at the end
- CurrentCharNum = Mid(DataToEncode, i, 1)
- 'multiply by the weighting factor which is 3,1,3,1...
- 'and add the sum together
- WeightedTotal = WeightedTotal + CurrentCharNum * factor
- 'change factor for next calculation
- factor = 4 - factor
- Next
- 'Find the CheckDigit by finding the smallest number that = a multiple of 10
- i = (WeightedTotal Mod 10)
- If i <> 0 Then
- CheckDigit = (10 - i)
- Else
- CheckDigit = 0
- End If
- 'Add check digit to number to DataToEncode
- DataToEncode = DataToEncode & CheckDigit
- 'Check for an even number of digits, add 0 if not even
- If (Len(DataToEncode) Mod 2) = 1 Then
- DataToEncode = "0" & DataToEncode
- end if
- StringLength = Len(DataToEncode)
- For i = 1 To StringLength Step 2
- 'Get the value of each number pair
- CurrentCharNum = (Mid(DataToEncode, i, 2))
- 'Get the AscWII value of CurrentChar according to chart by to the value
- If CurrentCharNum < 94 Then
- DataToPrint = DataToPrint & ChrW(CurrentCharNum + 33)
- end if
- If CurrentCharNum > 93 Then
- DataToPrint = DataToPrint & ChrW(CurrentCharNum + 103)
- end if
- Next
- 'ReturnType 0 returns data formatted to the barcode font
- If ReturnType = 0 Then
- MacroXLS = ChrW(203) & DataToPrint & ChrW(204) & " "
- End If
- 'ReturnType 1 returns data formatted for human readable text
- If ReturnType = 1 Then
- MacroXLS = DataToEncode
- End If
- 'ReturnType 2 returns the check digit for the data supplied
- If ReturnType = 2 Then
- MacroXLS = CStr(CheckDigit)
- End If
- end function
- Function GeneraCodigoBarrasCAE()
- on error resume next
- Dim cuit, numclase, ptoventa, fecae
- Dim x, d, p, i, cont
- Dim numero
- Dim anchocodigo
- 'funcion que compone el codigo de barras
- 'Cuit de la empresa que origina el CAE
- cuit = Replace(Replace(label10.Caption, "C.U.I.T.: ", ""), "-", "")
- 'numero de clase
- if len(label16.text) = 1 then
- numclase = "0" & label16.text
- else
- numclase = label16.text
- end if
- 'Punto de Venta
- ptoventa = Mid(Field11.Text, 1, 4)
- 'le da formarto a la fecha de vencimiento del cae
- fecae = appcontext.funciones.formato(field31.Text, "yyyymmdd")
- 'arma numero de codigo de barra
- numero = cuit & numclase & ptoventa & Field30.Text & fecae
- 'arma digitoverificador
- p = 0
- i = 0
- cont = 0
- For x = 1 To Len(numero)
- If cont = 0 Then
- i = i + Int(Mid(numero, x, 1))
- cont = cont + 1
- Else
- p = p + Int(Mid(numero, x, 1))
- cont = cont - 1
- End If
- Next
- d = Int(i * 3) + Int(p) - 1000
- d = Right(d, 1)
- 'agrega digito verificador
- numero = numero & d
- 'devuelve valor
- GeneraCodigoBarrasCAE = numero
- 'vacio variables
- Set cuit = Nothing
- Set numclase = Nothing
- Set ptoventa = Nothing
- Set fechacae = Nothing
- Set x = Nothing
- Set d = Nothing
- Set p = Nothing
- Set i = Nothing
- Set cont = Nothing
- Set numero = Nothing
- end Function
- Sub OnAfterPrint
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement