gyanugyan Level: Guest

|
Re: Printing problem in VB on Dot Matrix Printer
Code is given below
This code is working well in case of Ink Jet Printer But in Dot Matrix Printer its not working, it just print first 10-12 characters of each line
***************************************************
Private Sub printCode()
Printer.Height = 16840
Printer.ScaleHeight = 15890
Printer.Font = "Courier New"
Printer.FontSize = 9
Printer.FontBold = False
Printer.TextWidth (80)
Printer.FontBold = True
Printer.Print Tab(4); "1. NAME: " & txtName.Text
Printer.FontBold = False
Printer.Print Tab(4); "2. FATHER'S NAME: " & txtFatherName.Text
Printer.Print Tab(4); "3. ADDRESS: " & printString(txtAddress.Text, 83)
Printer.Print Tab(4); " PIN: " & printString(txtPinCode.Text, 41) & "TELEPHONE: " & txtPhone.Text
Printer.Print Tab(4); "4. Permanent Account Number: " & printString(txtPAN.Text, 20) & "8. Ward/Circle/Special Range: " & printString(txtWardCircle.Text, 19)
Printer.Print Tab(4); "5. Date of Birth: " & printString(DOB.Value, 31) & "9. Sex: " & sex
Printer.Print Tab(4); "6. Individual/Hindu Undivided family/Firm/ " & "10. Income for the previous year"
Printer.Print Tab(4); " Association of Persons/Local Authority: " & " i.e., " & prevFrom.Value & " To " & prevTo.Value
Printer.Print Tab(4); " " & printString(CStr(personType), 45) & " 11. Assessment Year:" & txtAssessYear.Text
Printer.Print Tab(4); "7. Resident/Non-Resident/Not Oridinarily Resident" & "12. Return: " & returnType
Printer.Print Tab(4); "----------------------------------------------------------------------------------------------------"
Printer.Print Tab(4); "13. Details of *Bank Accounts"
Printer.Print Tab(4); "----------------------------------------------------------------------------------------------------"
Printer.Print Tab(4); " Name of The Bank | Address of Branch | Account No. "
Printer.Print Tab(4); "----------------------------------------------------------------------------------------------------"
Printer.Print Tab(4); " " & printString(txtBankName.Text, 32) & " | " & printString(txtBranchAddress.Text, 32) & " | " & printString(txtAcNo.Text, 25)
'Printer.Print Tab(4); "----------------------------------------------------------------------------------------------------"
'Printer.Print Tab(4); " *Please Tick the Bank Account, where you would like the amount of refunt to be credited "
Printer.Print Tab(4); "----------------------------------------------------------------------------------------------------"
Printer.Print Tab(4); "14. Detail of Credit Card | Credit Card Number | Issued by "
Printer.Print Tab(4); "----------------------------------------------------------------------------------------------------"
Printer.Print Tab(4); " " & printString(txtCCDetail.Text, 32) & " | " & printString(txtCCNo.Text, 32) & " | " & printString(txtIssuedBy.Text, 25)
Printer.Print Tab(4); "----------------------------------------------------------------------------------------------------"
Printer.Print Tab(4); "15. INCOME FROM SALARY(Attached Form No. 16) " & printBlank(txtSalary.Text, 31) & "Rs.|" & printStringR(txtSalary.Text, 20)
Printer.Print Tab(4); "16. INCOME FROM HOUSE PROPERTY " & printBlank(txtHouse.Text, 31) & "Rs.|" & printStringR(txtHouse.Text, 20)
Printer.Print Tab(4); "17. INCOME FROM BUSINESS OR PROFESSION " & printBlank(txtBusiness.Text, 31) & "Rs.|" & printStringR(txtBusiness.Text, 20)
Printer.Print Tab(4); "18. CAPITAL GAINS 15/9 15/12 15/3 31/3 TOTAL |"
Printer.Print Tab(4); " (a)Short Term " & printBlank(txtCGShort.Text, 6) & " " & printString(txtCGShort159.Text, 8) & " " & printString(txtCGShort1512.Text, 8) & " " & printString(txtCGShort153.Text, 8) & " " & printString(txtCGShort313.Text, 8) & " " & printString(txtCGShortTotal.Text, 8) & "Rs.|"
Printer.Print Tab(4); " (a)Long Term " & printBlank(txtCGLong.Text, 6) & " " & printString(txtCGLong159.Text, 8) & " " & printString(txtCGLong1512.Text, 8) & " " & printString(txtCGLong153.Text, 8) & " " & printString(txtCGLong313.Text, 8) & " " & printString(txtCGLongTotal.Text, 8) & "Rs.|" & printStringR(CSng(txtCGLongTotal.Text) + CSng(txtCGShortTotal.Text), 20)
Printer.Print Tab(4); "19. INCOME FROM OTHER SOURCES " & printBlank(txtOther.Text, 31) & "Rs.|" & printStringR(txtOther.Text, 20)
Printer.Print Tab(4); "20. INCOME OF OTHER PERSON TO BE ADDED " & printBlank(txtAdded.Text, 31) & "Rs.|" & printStringR(txtAdded.Text, 20)
Printer.Print Tab(4); "21. GROSS TOTAL (15+16+17+18+19+20) " & printBlank(txtGross.Text, 31) & "Rs.|" & printStringR(txtGross.Text, 20)
Printer.Print Tab(4); "22. LESS: DEDUCTIONS UNDER CHAPTER VI-A: SECTION AMOUNT(Rs.) |"
Printer.Print Tab(4); " (a) " & printString(txtDedSectionA.Text, 13) & " " & printString(txtDedAmountA.Text, 13) & " |"
Printer.Print Tab(4); " (b) " & printString(txtDedSectionB.Text, 13) & " " & printString(txtDedAmountB.Text, 13) & " |"
Printer.Print Tab(4); " (c) " & printString(txtDedSectionC.Text, 13) & " " & printString(txtDedAmountC.Text, 13) & " Rs.|"; printStringR(CSng(txtDedAmountA.Text) + CSng(txtDedAmountB.Text) + CSng(txtDedAmountC.Text), 20)
Printer.Print Tab(4); "23. TOTAL INCOME: (21-22) " & printBlank(txtTotal.Text, 31) & "Rs.|" & printStringR(txtTotal.Text, 20)
Printer.Print Tab(4); "24. ADD: AGRICULTURAL INCOME (For rate purpose) " & printBlank(txtAgriculture.Text, 28) & "Rs.|"; printStringR(txtAgriculture.Text, 20)
Printer.Print Tab(4); "25. INCOME CLAIMED TO BE EXEPTED FROM INCOME TAX " & printBlank(txtExempted.Text, 27) & "Rs.|" & printStringR(txtExempted.Text, 20)
Printer.Print Tab(4); "26. TAX ON TOTAL INCOME INCOME INCOME TAX |"
Printer.Print Tab(4); " (a) At normal rates " & printBlank(txtTaxNormalRate.Text, 17) & printString(txtNormalIncome.Text, 13) & " " & printString(txtNormalTax.Text, 13) & " |"
Printer.Print Tab(4); " (b) At special rates " & printBlank(txtTaxSpecialRate.Text, 17) & printString(txtSpecialIncome.Text, 13) & " " & printString(txtSpecialTax.Text, 13) & " Rs.|" & printStringR(CSng(txtNormalTax.Text) + CSng(txtSpecialTax.Text), 20)
Printer.Print Tab(4); "27. LESS: REBATE " & printBlank(txtRebate.Text, 31) & "Rs.|" & printStringR(txtRebate.Text, 20)
Printer.Print Tab(4); "28. TAX PAYABLE " & printBlank(txtTaxPayable.Text, 31) & "Rs.|" & printStringR(txtTaxPayable.Text, 20)
Printer.Print Tab(4); "29. ADD: SURCHARGE " & printBlank(txtSurcharge.Text, 31) & "Rs.|" & printStringR(txtSurcharge.Text, 20)
Printer.Print Tab(4); "30. TOTAL TAX PAYABLE (28+29) " & printBlank(txtTTaxPayable.Text, 31) & "Rs.|" & printStringR(txtTTaxPayable.Text, 20)
Printer.Print Tab(4); "31. LESS: RELIEF " & printBlank(txtRelief.Text, 31) & "Rs.|" & printStringR(txtRelief.Text, 31)
Printer.Print Tab(4); "32. NET TAX PAYABLE " & printBlank(txtNTaxPayable.Text, 31) & "Rs.|" & printStringR(txtNTaxPayable.Text, 20)
Printer.Print Tab(4); "33. LESS: TAX DEDUCTED AT SOURCE " & printBlank(txtTaxDedSource.Text, 31) & "Rs.|" & printStringR(txtTaxDedSource.Text, 20)
If CSng(txtAdvTax1.Text) > 0 Then
dateStr = printString(advDate1.Value, 20)
Else
dateStr = printString("", 20)
End If
If CSng(txtAdvTax2.Text) > 0 Then
dateStr = dateStr & printString(advDate2.Value, 20)
Else
dateStr = dateStr & printString("", 20)
End If
If CSng(txtAdvTax3.Text) > 0 Then
dateStr = dateStr & printString(advDate3.Value, 20)
Else
dateStr = dateStr & printString("", 20)
End If
Printer.Print Tab(4); "34. LESS: ADVANCE TAX PAID |"
'Printer.Print Tab(4); " Date Date Date |"
Printer.Print Tab(4); " " & dateStr & " |"
'Printer.Print Tab(4); " Amount Amount Amount |"
Printer.Print Tab(4); " " & printString(txtAdvTax1.Text, 20) & printString(txtAdvTax2.Text, 20) & printString(txtAdvTax3.Text, 17) & printString((CSng(txtAdvTax1.Text) + CSng(txtAdvTax2.Text) + CSng(txtAdvTax3.Text)), 12) & "Rs.|" & printStringR((CSng(txtAdvTax1.Text) + CSng(txtAdvTax2.Text) + CSng(txtAdvTax3.Text)), 20)
Printer.Print Tab(4); " (Under Section) 234A 234B 234C TOTAL |"
Printer.Print Tab(4); "35. ADD: INTEREST PAYABLE " & printString(txtInterestA.Text, 12) & printString(txtInterestB.Text, 12) & printString(txtInterestC.Text, 12) & printString((CSng(txtInterestA.Text) + CSng(txtInterestB.Text) + CSng(txtInterestC.Text)), 12) & "Rs.|" & printStringR((CSng(txtInterestA.Text) + CSng(txtInterestB.Text) + CSng(txtInterestC.Text)), 20)
Printer.Print Tab(4); "36. LESS: SELF ASSESSMENT TAX PAID " & printString("On Date " & SATPaidDate.Value, 31) & "Rs.|" & printStringR(txtSelfAssessment.Text, 20)
Printer.FontBold = True
If CSng(txtBalanceTax.Text) >= 0 Then
Printer.Print Tab(4); "37. BALANCE TAX: PAYABLE/REFUNDABLE " & printBlank(txtBalanceTax.Text, 31) & "Rs.|" & printStringR(txtBalanceTax.Text, 20)
Else
Printer.Print Tab(4); "37. BALANCE TAX: PAYABLE/REFUNDABLE " & printBlank(txtBalanceTax.Text, 31) & "Rs.|" & printStringR("(" & txtBalanceTax.Text & ")", 20)
End If
Printer.FontBold = False
Printer.Print Tab(4); "----------------------------------------------------------------------------------------------------"
Printer.FontUnderline = True
Printer.Print Tab(4); "DOCUMENT ATTACHED WITH THE RETURN"
Printer.FontUnderline = False
Printer.Print Tab(4); " VERIFICATION "
Printer.FontBold = True
Printer.Print Tab(4); "I " & printString(UCase(txtName.Text), 40) & " son/daughter of " & printString(UCase(txtFatherName.Text), 42)
Printer.FontBold = False
Printer.Print Tab(4); "solemnly decalare that to the best of my knowledge and belief, the information given in this return"
Printer.Print Tab(4); "and annexures and statements accompnying it are correct, complete and truly stated and in accordance"
Printer.Print Tab(4); "with the provisions of Income Tax Act, 1961, in respect of income chargeable to income tax for the"
Printer.Print Tab(4); "previous year relevant to the assessment year " & txtAssessYear.Text & "."
'Printer.Print Tab(4); ""
Printer.Print Tab(4); "Receipt No.______________ Date __________"
Printer.Print Tab(4); " Seal Signature "
Printer.Print Tab(4); " Date : "
Printer.Print Tab(4); " Signature of the receiving official Place:"
Printer.EndDoc
End Sub
Function printString(str As String, n As Integer) As String
Dim i As Integer
i = Len(str)
If i >= n Then
printString = Left(str, n)
ElseIf i < n Then
printString = str & Space(n - i)
End If
End Function
Function printStringR(str As String, n As Integer) As String
Dim i As Integer
i = Len(str)
If i >= n Then
printStringR = Left(str, n)
ElseIf i < n Then
printStringR = Space(n - i) & str
End If
End Function
**************************************************
|