Home » Developer & Programmer » Forms » Cheque Printing Issue (Forms 6i)
Cheque Printing Issue [message #501420] Tue, 29 March 2011 01:20 Go to next message
expertsudhir
Messages: 26
Registered: October 2008
Location: Delhi, India
Junior Member

I have developed a code to print a cheque.

But there is a problem. what I need is Load/Eject before start printing. I am not able to supply control character. Please help me.

The code :
Declare
	out_file Text_IO.File_Type;
  v_out varchar2(2500);
  xpath varchar2(50);
  --
  i number;
  l number;
  ln Number;
  St1 Varchar2(100);
  St2 Varchar2(100);  
  PayeeName Varchar2(160);
  Amount Number;
  --
	AmtInWord Varchar2(1000);
Begin	
  PayeeName := 'KUMAR SUDHIR';
  Amount    := 12345678;
	--------------- File Creation ---------------
  xpath:='C:\Cheque'||To_Char(Sysdate,'ddmmyy')||'.TXT';
	out_file:= Text_IO.Fopen(xpath,'W');
  if Text_IO.Is_Open(out_file) then
	  	Text_IO.Put_Line(out_file, chr(27)||chr(25));--1
	    --Date print
	  	v_out := null;
	  	For i in 1..65
	  	Loop
	  		v_out := v_out||Chr(32);
	  	End Loop;
	  	v_out := v_out||To_Char(Sysdate, 'DD-MM-YYYY');
	  	Text_IO.Put_Line(out_file,v_out); ----- 1
	    --Payee Name Print 1st line
	    v_out := null;
	    For i in 1..6
	    Loop
	    	v_out := v_out||Chr(32);
	    End Loop;
	    v_out := v_out ||SubStr(PayeeName, 0, 70);
	    Text_IO.Put_Line (out_file, v_out); ----- 2
	  	--Payee Name Print 2nd Line
  		v_out := chr(32);
  		--v_out := v_out||SubStr(PayeeName, 71);
  		Text_IO.Put_Line (out_file, ' '); ----- 3
  		Text_IO.Put_Line (out_file, ' '); ----- 4
  		--
  		--Amount in word
 		  AmtInWord := Common.ToWord(Amount);
 		  ---- Break Amount in Word ---
    	If Length(AmtInWord) <= 44 Then
    		St1 := Substr(AmtInWord, 0, 44);
    		St2 := Null;
    	 Else
    	  If Substr(AmtInWord,44,1) = ' ' Then
	    		St1 := Substr(AmtInWord, 1, 44);
	    		St2 := Substr(AmtInWord, 45);
    	   Else
	    		St1 := Substr(AmtInWord, 1, Instr(Substr(AmtInWord,0,44),' ',-1));
	    		St2 := Substr(AmtInWord, Instr(Substr(AmtInWord,0,44),' ',-1));
    	  End If;
    	End If;	
    	---------------------
 		  --1st line
  		v_out := null;
    	For i in 1..10
    	Loop
    		v_out := v_out||Chr(32);
    	End Loop;

    	v_out := v_out||St1;
    	
    	Text_IO.Put_Line (out_File, v_out); ---- 5
    	--2nd Line + Amount in Figure
  		v_out := null;
    	For i in 1..10
    	Loop
    		v_out := v_out||Chr(32);
    	End Loop;
    	v_out := v_out||St2;
    	--
    	l := Length (v_out);
    	For i in l..58
    	Loop
    		v_out := v_out||chr(32);
    	End Loop;
    	v_out := v_out||LTrim(Rtrim(To_Char(Amount, '99,99,99,99,999.99')));
    	Text_IO.Put_Line (out_File, v_out);
    	--15 Blank Line
    	v_out:=Chr(32);
    	For i in 1..15
    	Loop
    		Text_IO.Put_Line (out_File, v_out);
    	End Loop;	
	End If;
  Text_IO.Fclose(out_file); 
  --End Operation file--
  synchronize;
  Host('cmd /c Type '||xpath||'> prn');   
  --
End;


[EDITED by LF: applied [code] tags]

[Updated on: Tue, 29 March 2011 01:34] by Moderator

Report message to a moderator

Re: Cheque Printing Issue [message #501463 is a reply to message #501420] Tue, 29 March 2011 05:50 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
expertsudhir wrote on Tue, 29 March 2011 07:20
what I need is Load/Eject before start printing. I am not able to supply control character.


You need to explain that in more detail. Load what? What control character?
Re: Cheque Printing Issue [message #501491 is a reply to message #501463] Tue, 29 March 2011 07:45 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Looks like Form Feed to me. If so, you should know that escape sequence; but, how to send it to a printer - no idea, I never did that.

Can't you just place a paper into the loading tray, press "Load/Eject" button on printer's control board and load the paper?
Previous Topic: Form Builder
Next Topic: How to store Word/Excel documents to BLOB Column(merged)
Goto Forum:
  


Current Time: Mon Sep 16 13:10:08 CDT 2024