Home » Developer & Programmer » Forms » Coupan calculation in pos (Db 11g forms 6i)
Coupan calculation in pos [message #679878] Thu, 09 April 2020 05:05 Go to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
Hi All

please help if possible m trying explain my problem

My is prob is this I have designed application regarding point if sale I have had got full help from this forum application working successfully but coupan issue is still there


Itemcode desc qty price coup_disc% total
1. ABC. 1. 100. 100
2. Etc. 2. 150. 300
3. Poj. 1. 50. 5

G_total
400
Coup_disc
20

My problem is this I want to calculate coupan disc
from g_total it's working but only when I go to
Same code suppose 3 if I moved to any other code like icode 2 or 3 etc so coup_disc is becoming null my code is

Key-next-item

Coup_disc:=:g_tot/100*:coup_disc;

It should work if moved to any icode

Sorry for bad English

Thanks
Re: Coupan calculation in pos [message #679879 is a reply to message #679878] Thu, 09 April 2020 05:11 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
[quote title=Amjad_1975 wrote on Thu, 09 April 2020 05:05]Hi All

please help if possible m trying explain my problem

My is prob is this I have designed application regarding point if sale I have had got full help from this forum application working successfully but coupan issue is still there

Itemcode desc qty price coup_disc%  total
1.       ABC.  1.  100.            100
2.       Etc.  2.  150.            300
3.       Poj.  1.  50.   5

                                  G_total
                                   400
                                  Coup_disc
                                    20

My problem is this I want to calculate coupan disc
from g_total it's working but only when I go to
Same code suppose 3 if I moved to any other code like icode 2 or 3 etc so coup_disc is becoming null my code is 

Key-next-item

Coup_disc:=:g_tot/100*:coup_disc;

It should work if moved to any icode 

Sorry for bad English

Thanks
Re: Coupan calculation in pos [message #679883 is a reply to message #679879] Thu, 09 April 2020 08:00 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is that the full code?
It won't compile - there's no colon on the first coup_disc so forms will assume it's a local variable and you haven't declared one.

You appear to have two coup_disc items - what are they actually called? what block are they in?
Re: Coupan calculation in pos [message #679884 is a reply to message #679883] Thu, 09 April 2020 09:18 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
no sir this not a full code Code are as below

I have a 3 blocks 1 is control which r havinf trigger

key-next-item-----which r working with barcode scanner

2nd block master 3rd transaction

everythingis working fine except coupan


trigger key-next-item

block

control.A

DECLARE 
         l_match boolean:=false;
         l_continue boolean:=true;
         VV varchar2(30);
         aa number(8);
         bb varchar2(15);
         cc varchar2(8);
         dd varchar2(8);
         a number;
         b number;
         vn number;
         EE NUMBER;
ff number;
BEGIN 
    BEGIN 
  
        SELECT stk_code INTO :control.a FROM add_item
        WHERE add_item.stk_code=:control.a;
 
     EXCEPTION 
        WHEN NO_DATA_FOUND THEN 
        MESSAGE('Item code does not Excist');
        MESSAGE('Item code does not Excist');
        CLEAR_ITEM;
     RAISE FORM_TRIGGER_FAILURE;
     END;
		      go_block('itrn_bar');
	    	FIRST_rECORD;
	    	
	WHILE l_continue and not l_match LOOP
		select c_date 
 		       into 
             vv from add_item  where stk_code = :control.a;			
 	    if  to_char(sysdate,'mon-dd-yyyy hh:mi:ss')>=vv then
            message('!!! Coupan is Expired   '|| vv);
            message('!!! Coupan is Expired   '|| vv);
       go_block('control');
 	    end if;
 				IF :itrn_bar.item_Code=:CONTROL.a THEN 
	     	     :itrn_bar.qty:=:itrn_bar.qty+1;
             :itrn_bar.t_cost:=:itrn_bar.qty*:itrn_bar.unt_price;

		     	L_MATCH:=TRUE;
	ELSE
			if :system.last_record!='TRUE' THEN
				
	      NEXT_RECORD;
			ELSE
			L_CONTINUE:=FALSE;
	  
			END IF;
			END IF;
	
	END LOOP;
  
   next_RECORD;
   	 
IF NOT L_MATCH THEN
		   
   			select stk_code,description,qty,itm_dis,itm_tax,c_dis,unt_prc,ad_level2,op_typ,cust_no into 
   	     	   	:itrn_bar.item_Code,
   	     	   	:itrn_bar.item_name,
   	   	    	:itrn_bar.qty,
  	   	    :itrn_bar.dis_prc,
  	   	    :itrn_bar.tax,
   	   	    :itrn_bar.c_prc,
   	   	   
  	              aa,
        	    	bb,
    	   	    	cc,
 		        dd
   			  	        	from add_item,CLIENT
   			           where stk_code=:control.a and 
   			                CLIENT.cust_no=:imaster_bar.p_code;
				if cc='level2' then
          	:itrn_bar.unt_price:=bb;
		else
				    
  	:itrn_bar.unt_price:=aa;
		end if;
		
:itrn_bar.t_cost:=:itrn_bar.qty*:itrn_bar.unt_price;
:coupan_amt:=:ITRN_BAR.TCOST_TOTAL/100*:itrn_bar.c_prc;
	

END IF;
      
go_block('control');
go_item('control.a');
clear_block;
	
			END;

sir sorry for not manipulating the code

My problem is this I want to calculate coupan disc
from TCOST_TOTAL it's working but only when I go to
Same code suppose Coupan code if I moved to any other code for entry like icode 2 or 3 etc so coup_disc is becoming null my code is

in master table fields

date
p_code
name

in transaction

item_code
description
qty
unit price
coupan_dis---c_prc
-------------------
grand total---tcost_total

coupan amount----coupan_amt

thanks

[Updated on: Thu, 09 April 2020 09:25]

Report message to a moderator

Re: Coupan calculation in pos [message #679887 is a reply to message #679884] Thu, 09 April 2020 10:19 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
screen shots attached problem will be clear more
  • Attachment: scr.png
    (Size: 64.16KB, Downloaded 48 times)
Re: Coupan calculation in pos [message #679888 is a reply to message #679887] Thu, 09 April 2020 10:20 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
2nd
  • Attachment: scr2.png
    (Size: 65.89KB, Downloaded 61 times)
Re: Coupan calculation in pos [message #679889 is a reply to message #679888] Thu, 09 April 2020 11:42 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
Sir above little mistake actually coupan code having no
Unit price but still same issue whenever coupan code has come discount should be directly calculate from Grand total only
As mentioned my above code


Item_code  desc.      Qty.  Unt_prc. C_disc  Total

1.         ABC.        1.    200.             200
C002.      10% disc.   1.     0.       10.    0 
2.         Device.     2.     150.            300
3.          Etc        1.     50.             50
                                       g_tot  230+50=270
                                       C_disc  3 should be 27

Thanks

[Updated on: Thu, 09 April 2020 11:42]

Report message to a moderator

Re: Coupan calculation in pos [message #679925 is a reply to message #679889] Tue, 14 April 2020 02:54 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
I think the problem is due to the fact that you've got the total items in the same datablock as the other stuff.
They need to be in seperate datablocks
Re: Coupan calculation in pos [message #679928 is a reply to message #679925] Tue, 14 April 2020 03:41 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
Kindly guide me sir I tried to put c_prc coupan disc in separate
Block such as created new block as well.as try to put in master block in my case which is imaster_bar

Thanks

[Updated on: Tue, 14 April 2020 03:50]

Report message to a moderator

Re: Coupan calculation in pos [message #679929 is a reply to message #679928] Tue, 14 April 2020 03:56 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
You need to tell us what exactly you tried and what problems you had with it.

Moving items to a different block isn't difficult.
Re: Coupan calculation in pos [message #679930 is a reply to message #679929] Tue, 14 April 2020 04:02 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
Sir simply I want to calculate coupan discount direct from grand total which will appear below total
Problem is it is calculated but when I moved to any other code or enter new code coupan discount becoming blank whenever grand total increase coupan discount automatically should increase because coupan discount calculating from g_total
Re: Coupan calculation in pos [message #679931 is a reply to message #679930] Tue, 14 April 2020 04:27 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member

Sir this simple code
DECLARE 
         l_match boolean:=false;
        l_continue boolean:=true;
       VV DATE;
			BEGIN 
		      go_block('itrn_bar');
	    	FIRST_rECORD;
	WHILE l_continue and not l_match LOOP
		IF :itrn_bar.item_Code=:CONTROL.a THEN 
	     :itrn_bar.qty:=:itrn_bar.qty+1;
		     	L_MATCH:=TRUE;
	ELSE
			if :system.last_record!='TRUE' THEN
	      NEXT_RECORD;
			ELSE
  			L_CONTINUE:=FALSE;
			END IF;
			END IF;
	END LOOP;
   next_RECORD;
   	 
  
IF NOT L_MATCH THEN
	
		  --:EMP.cc =:CONTROL.zz then
   			select stk_code,description,qty,unt_prc,C_DIS into 
   	     	   	:itrn_bar.item_Code,
   	     	   	:itrn_bar.item_name,
   	   	    	:itrn_bar.qty,
   	   	    	:itrn_bar.unt_price,
   	   	      :itrn_bar.C_prc
        from add_item
               where stk_code=:control.a 
:itrn_bar.total:=:itrn_bar.qty*:itrn_bar.unt_price;
 END IF;
if :itrn_bar.item_code!=:control.a OR	L_MATCH=TRUE then
 	previous_record;
end if;
go_item('control.a');
clear_block;
END;

At coupan discount  field formula

:itrn_bar.G_tot/100*:itrn_bar.c_prc;
Thanks

[Updated on: Tue, 14 April 2020 04:28]

Report message to a moderator

Re: Coupan calculation in pos [message #679932 is a reply to message #679931] Tue, 14 April 2020 04:33 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
So how's the grand total calculated?
what is control.a? - Use proper names, don't expect others to guess what 'a' is supposed to represent.

Is the grand total in the control block? If not it needs to be.
Re: Coupan calculation in pos [message #679933 is a reply to message #679932] Tue, 14 April 2020 05:29 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
Grant total is in transaction block
Sir control block having only field named A ----key-next-item

Others all fields are in transaction block

I have only 2 blocks

Control block having only field name a

Imaster_bar --- master block
Date
Party code
Party name

Itrn_bar -- transaction block
Fields

Item_code
Desc
Qty
Unit price
C_disc
Total

Grant total

Coupan discount

Net total


[Updated on: Tue, 14 April 2020 05:30]

Report message to a moderator

Re: Coupan calculation in pos [message #679936 is a reply to message #679933] Tue, 14 April 2020 07:24 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
You still haven't explained what "a" is.

Does the grand total map to an item in the table the transaction block is based on?
Re: Coupan calculation in pos [message #679940 is a reply to message #679936] Tue, 14 April 2020 07:56 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
sir is a clear picture regarding item 'A' which is in control block where i put trigger --Key-nect-item



thanks
Re: Coupan calculation in pos [message #679941 is a reply to message #679940] Tue, 14 April 2020 08:02 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
PIX
Re: Coupan calculation in pos [message #679944 is a reply to message #679941] Tue, 14 April 2020 08:47 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
That doesn't tell me anything useful at all.
What data is it supposed to contain?
Re: Coupan calculation in pos [message #679945 is a reply to message #679944] Tue, 14 April 2020 08:54 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
Sir kindly let me know what exactly u need shall I send .fmb n table structure. 'A' is a item which in control block where m firing trigger which is key-next-item where we r using bar code scanner

Source code I have had already sent u as above



Thanks

[Updated on: Tue, 14 April 2020 08:57]

Report message to a moderator

Re: Coupan calculation in pos [message #679951 is a reply to message #679945] Tue, 14 April 2020 11:13 Go to previous messageGo to next message
Michel Cadot
Messages: 67144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

To who are you talking as U is dead?

Re: Coupan calculation in pos [message #679970 is a reply to message #679951] Wed, 15 April 2020 02:45 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
So a is an item that's feed data by a scanner?
And that's then used to set everything in the block?

Name it scan_item then. Or something else meaningful.
Suppose you get hit by a bus tomorrow and someone else has to pick up the form and make modifications - how are they going to know what control.a is for?


Quote:

I have only 2 blocks

Control block having only field name a

Imaster_bar --- master block
Date
Party code
Party name

Itrn_bar -- transaction block
Fields

Item_code
Desc
Qty
Unit price
C_disc
Total
You say you only have 2 blocks and then immediately list 3 - control, Imaster_bar and Itrn_bar - so is it 2 blocks or 3?

What is the name of the grand total item and which block is it in?


I don't have a working forms installation at the moment so an fmb will be no use to me.
Re: Coupan calculation in pos [message #679987 is a reply to message #679970] Thu, 16 April 2020 08:23 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
Sir
Grand total
Coupan amt
Net total


All r in transaction block.in my case
Itrn_bar

Sorry to tell you regarding control block
Control block only containing scanned item
Named 'A' where user scanning barcode scanner


Re: Coupan calculation in pos [message #679988 is a reply to message #679987] Thu, 16 April 2020 08:49 Go to previous messageGo to next message
Michel Cadot
Messages: 67144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
All r in transaction

What is r?

Please read the OraFAQ Forum Guide, especially #6.

Re: Coupan calculation in pos [message #679989 is a reply to message #679988] Thu, 16 April 2020 08:59 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
That didn't answer my question about how many blocks there are.

You also still haven't told me the name of the grand total item - item names don't contain spaces. Seriously you need to actually answer simple questions.

And why are the grand total, net total and coupon amount in the Itrn_bar block? Do they have corresponding columns in the table the block is based on?
Re: Coupan calculation in pos [message #679992 is a reply to message #679989] Thu, 16 April 2020 11:35 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
There are total 5 blocks

Control block

Which r containing item A where m firing a trigger key-next code as above

Imaster_bar---master block

Itrn_bar----child

Button block containing only buttons

Block42 only buttons


G_tot as Grand total. Summarized
Am_paid as coupan amount
Net_tot. As net total

Sir that's why m asking questions because m wrong somewhere
If I put all these 3 coloums in itrn_bar block may be m wrong kindly correct me where m wrong n kindly solved this issue I saw on this forum you r one of the genius person there is no doubt about this.


Thanks

[Updated on: Thu, 16 April 2020 11:38]

Report message to a moderator

Re: Coupan calculation in pos [message #679993 is a reply to message #679992] Thu, 16 April 2020 11:55 Go to previous messageGo to next message
Michel Cadot
Messages: 67144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

And you are one of the disrespectful person there is no doubt about this.

Re: Coupan calculation in pos [message #679994 is a reply to message #679993] Thu, 16 April 2020 13:28 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
Mr @cadot you r always useless person on this forum I red all threads you are always disgraceful person you r never able to answers of any question you r not eligible person for this forum join any circus that will be better for u always I don't know why you r interfering in this matter if you r not able answer.


This forum for all anybody can questions here and answers

[Updated on: Thu, 16 April 2020 13:31]

Report message to a moderator

Re: Coupan calculation in pos [message #679996 is a reply to message #679994] Thu, 16 April 2020 13:46 Go to previous messageGo to next message
Michel Cadot
Messages: 67144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
This forum for all anybody can questions here and answers

It is for those who comply to its rules.

Repeated violations of the forum rules will lead to banishment, is this what you want?
Respect those who help you, respect this forum and its members, follow the rules and don't use IM/SMS speak.
If you don't want to follow the rules of a community, why do you join it?
Do think really you deserve help from it?

I doubt you have red the 67 thousand posts I wrote here in one hour and half.
This lie is another mark of your contempt for us.

By the way, to answer your question, I'm also here to remind the rules to those who violate them.

Re: Coupan calculation in pos [message #679998 is a reply to message #679996] Thu, 16 April 2020 13:59 Go to previous messageGo to next message
Michel Cadot
Messages: 67144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

In addition, reading this topic from you, you have to admit that I helped you to understand that what you wanted to achieve can't be.
So, am I so helpless?

[Updated on: Thu, 16 April 2020 14:03]

Report message to a moderator

Re: Coupan calculation in pos [message #679999 is a reply to message #679993] Thu, 16 April 2020 14:02 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
I always respect people's those who r senior members on this forum and even juniors may be I misinterpreted if someone feels I grieved m really very sorry.

[Updated on: Thu, 16 April 2020 14:05]

Report message to a moderator

Re: Coupan calculation in pos [message #680000 is a reply to message #679999] Thu, 16 April 2020 14:03 Go to previous messageGo to next message
Michel Cadot
Messages: 67144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

And you say this still violating the rules!

Re: Coupan calculation in pos [message #680024 is a reply to message #680000] Sun, 19 April 2020 09:36 Go to previous messageGo to next message
Amjad_1975
Messages: 80
Registered: January 2017
Member
Thanks to.all specially @mughals_king who resolved my issue I sent him a personal mail he is resolved 100% anyway thanks again to.all
Finally solved

Thanks
Re: Coupan calculation in pos [message #680026 is a reply to message #680024] Sun, 19 April 2020 11:17 Go to previous message
Michel Cadot
Messages: 67144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

OraFAQ Forum Guide:

#12 If you found an answer yourself, post it. That way we know the issue is resolved and we might learn from it.

Previous Topic: Designer 6i connectivity to 18C db
Next Topic: Unable to retrieve an image
Goto Forum:
  


Current Time: Mon Jun 01 17:29:34 CDT 2020