@@ -10,7 +10,7 @@ function __construct()
1010
1111 function index ()
1212 {
13- $ this ->_reload ();
13+ $ this ->load_register ();
1414 }
1515
1616 function item_search ()
@@ -46,14 +46,14 @@ function select_customer()
4646 {
4747 $ customer_id = $ this ->input ->post ("customer " );
4848 $ this ->sale_lib ->set_customer ($ customer_id );
49- $ this ->_reload ();
49+ $ this ->load_register_content ();
5050 }
5151
5252 function change_mode ()
5353 {
5454 $ mode = $ this ->input ->post ("mode " );
5555 $ this ->sale_lib ->set_mode ($ mode );
56- $ this ->_reload ();
56+ $ this ->load_register_content ();
5757 }
5858
5959 //Alain Multiple Payments
@@ -69,7 +69,7 @@ function add_payment()
6969 else
7070 $ data ['error ' ]=$ this ->lang ->line ('sales_must_enter_numeric ' );
7171
72- $ this ->_reload ($ data );
72+ $ this ->load_register_content ($ data );
7373 return ;
7474 }
7575
@@ -83,7 +83,7 @@ function add_payment()
8383 if ( $ cur_giftcard_value <= 0 )
8484 {
8585 $ data ['error ' ]='Giftcard balance is ' .to_currency ( $ this ->Giftcard ->get_giftcard_value ( $ this ->input ->post ('amount_tendered ' ) ) ).' ! ' ;
86- $ this ->_reload ($ data );
86+ $ this ->load_register_content ($ data );
8787 return ;
8888 }
8989 elseif ( ( $ this ->Giftcard ->get_giftcard_value ( $ this ->input ->post ('amount_tendered ' ) ) - $ this ->sale_lib ->get_total () ) > 0 )
@@ -102,14 +102,14 @@ function add_payment()
102102 $ data ['error ' ]='Unable to Add Payment! Please try again! ' ;
103103 }
104104
105- $ this ->_reload ($ data );
105+ $ this ->load_register_content ($ data );
106106 }
107107
108108 //Alain Multiple Payments
109109 function delete_payment ($ payment_id )
110110 {
111111 $ this ->sale_lib ->delete_payment ($ payment_id );
112- $ this ->_reload ();
112+ $ this ->load_register_content ();
113113 }
114114
115115 function add ()
@@ -136,7 +136,7 @@ function add()
136136 {
137137 $ data ['warning ' ] = $ this ->lang ->line ('sales_quantity_less_than_zero ' );
138138 }
139- $ this ->_reload ($ data );
139+ $ this ->load_register_content ($ data );
140140 }
141141
142142 function edit_item ($ line )
@@ -168,19 +168,19 @@ function edit_item($line)
168168 }
169169
170170
171- $ this ->_reload ($ data );
171+ $ this ->load_register_content ($ data );
172172 }
173173
174174 function delete_item ($ item_number )
175175 {
176176 $ this ->sale_lib ->delete_item ($ item_number );
177- $ this ->_reload ();
177+ $ this ->load_register_content ();
178178 }
179179
180180 function delete_customer ()
181181 {
182182 $ this ->sale_lib ->delete_customer ();
183- $ this ->_reload ();
183+ $ this ->load_register_content ();
184184 }
185185
186186 function complete ()
@@ -219,7 +219,7 @@ function complete()
219219 if ( ( $ this ->sale_lib ->get_mode () == 'sale ' ) && ( ( to_currency_no_money ( $ data ['total ' ] ) - $ total_payments ) > 1e-6 ) )
220220 {
221221 $ data ['error ' ] = $ this ->lang ->line ('sales_payment_not_cover_total ' );
222- $ this ->_reload ($ data );
222+ $ this ->load_register_content ($ data );
223223 return false ;
224224 }
225225
@@ -318,8 +318,8 @@ function save($sale_id)
318318 echo json_encode (array ('success ' =>false ,'message ' =>$ this ->lang ->line ('sales_unsuccessfully_updated ' )));
319319 }
320320 }
321-
322- function _reload ( $ data = array () )
321+
322+ function prepare_data ( )
323323 {
324324 $ person_info = $ this ->Employee ->get_logged_in_employee_info ();
325325 $ data ['cart ' ]=$ this ->sale_lib ->get_cart ();
@@ -347,13 +347,26 @@ function _reload($data=array())
347347 $ info =$ this ->Customer ->get_info ($ customer_id );
348348 $ data ['customer ' ]=$ info ->first_name .' ' .$ info ->last_name ;
349349 }
350+
351+ return $ data ;
352+ }
353+
354+ function load_register ($ data =array ())
355+ {
356+ $ data = $ this ->prepare_data ();
350357 $ this ->load ->view ("sales/register " ,$ data );
351358 }
352359
360+ function load_register_content ($ data =array ())
361+ {
362+ $ data = $ this ->prepare_data ();
363+ $ this ->load ->view ("sales/register_content " ,$ data );
364+ }
365+
353366 function cancel_sale ()
354367 {
355368 $ this ->sale_lib ->clear_all ();
356- $ this ->_reload ();
369+ $ this ->load_register_content ();
357370
358371 }
359372
@@ -396,7 +409,7 @@ function suspend()
396409 $ data ['error_message ' ] = $ this ->lang ->line ('sales_transaction_failed ' );
397410 }
398411 $ this ->sale_lib ->clear_all ();
399- $ this ->_reload (array ('success ' => $ this ->lang ->line ('sales_successfully_suspended_sale ' )));
412+ $ this ->load_register_content (array ('success ' => $ this ->lang ->line ('sales_successfully_suspended_sale ' )));
400413 }
401414
402415 function suspended ()
@@ -412,7 +425,7 @@ function unsuspend()
412425 $ this ->sale_lib ->clear_all ();
413426 $ this ->sale_lib ->copy_entire_suspended_sale ($ sale_id );
414427 $ this ->Sale_suspended ->delete ($ sale_id );
415- $ this ->_reload ();
428+ $ this ->load_register ();
416429 }
417430}
418431?>
0 commit comments