2011-01-10 19:49:11 +00:00
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Text ;
2011-01-30 07:14:05 +00:00
using Tanshu.Accounts.Repository ;
2011-01-10 19:49:11 +00:00
using Tanshu.Accounts.Helpers ;
using Tanshu.Accounts.Contracts ;
using System.Windows.Forms ;
using Tanshu.Common ;
2011-01-30 07:14:05 +00:00
using Tanshu.Accounts.Entities ;
using Tanshu.Accounts.Entities.Auth ;
using Tanshu.Accounts.SqlDAO ;
2011-01-31 20:33:22 +00:00
using System.Collections.ObjectModel ;
2011-01-30 07:14:05 +00:00
2011-01-10 19:49:11 +00:00
namespace Tanshu.Accounts.PointOfSale
{
public class BillController
{
2011-01-30 07:14:05 +00:00
private SaleVoucher billInfo ;
private OrderedDictionary < BillItemKey , BillInventory > bill = new OrderedDictionary < BillItemKey , BillInventory > ( ) ;
2011-02-09 12:03:22 +00:00
int? editVoucherID ;
2011-01-10 19:49:11 +00:00
ISaleForm saleForm ;
2011-01-30 07:14:05 +00:00
private Customer customer = new CustomerBI ( ) . GetCustomer ( 1 ) ;
2011-02-09 12:03:22 +00:00
public BillController ( int? editVoucherID )
{
this . editVoucherID = editVoucherID ;
}
2011-01-10 19:49:11 +00:00
public void InitGui ( ISaleForm saleForm )
{
this . saleForm = saleForm ;
this . saleForm . SetCustomerDisplay ( customer . Name ) ;
this . saleForm . SetUserName ( Session . User . Name ) ;
}
private void InitComponents ( )
{
InitModel ( ) ;
InitView ( ) ;
}
private void InitView ( )
{
throw new NotImplementedException ( ) ;
}
private void InitModel ( )
{
throw new NotImplementedException ( ) ;
}
2011-01-30 07:14:05 +00:00
public void AddProductToGrid ( int productID )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
new BillHelperFunctions ( saleForm . BindingSource , bill , productID ) . AddProduct ( ) ;
2011-01-30 07:14:05 +00:00
Product product = ProductBI . GetProduct ( productID ) ;
if ( ProductGroupModifierBI . HasCompulsoryModifier ( product . ProductGroup . ProductGroupID ) )
{
var item = CurrentProduct ;
ShowModifiers ( product . ProductGroup . ProductGroupID , item ) ;
}
2011-01-10 19:49:11 +00:00
ShowAmount ( ) ;
2011-01-30 07:14:05 +00:00
}
2011-01-22 12:38:30 +00:00
2011-01-30 07:14:05 +00:00
public void ShowModifiers ( int productGroupID , BillInventory item )
{
2011-01-31 20:33:22 +00:00
if ( item . Printed > 0 )
return ;
2011-01-30 07:14:05 +00:00
var list = ProductGroupModifierBI . GetProductGroupModifiers ( productGroupID ) ;
using ( var frm = new ModifierForm ( list , item . Modifiers ) )
{
frm . ShowDialog ( ) ;
item . Modifiers = frm . Selection ;
}
2011-01-31 20:33:22 +00:00
ShowAmount ( ) ;
}
public void ShowDiscount ( )
{
2011-02-09 12:03:22 +00:00
if ( ! Session . IsAllowed ( RoleConstants . DISCOUNT ) )
return ;
2011-01-31 20:33:22 +00:00
var list = new ProductGroupBI ( ) . GetProductGroups ( ) ;
using ( var frm = new DiscountForm ( list ) )
{
if ( frm . ShowDialog ( ) = = DialogResult . OK )
{
IList < int > outList ;
decimal discount = frm . Selection ( out outList ) ;
discount = discount / 100 ;
foreach ( var item in bill )
{
var pg = new ProductGroupBI ( ) . GetProductGroupOfProduct ( item . Value . ProductID ) ;
if ( outList . Contains ( pg . ProductGroupID ) )
2011-02-09 12:03:22 +00:00
new BillHelperFunctions ( saleForm . BindingSource , bill , item . Value . ProductID ) . SetDiscount ( item . Value . Name , discount ) ;
2011-01-31 20:33:22 +00:00
}
}
}
ShowAmount ( ) ;
2011-01-10 19:49:11 +00:00
}
2011-01-30 07:14:05 +00:00
2011-01-10 19:49:11 +00:00
public void ShowCustomerList ( bool reset )
{
2011-01-30 07:14:05 +00:00
if ( ( customer . CustomerID = = 1 ) & & ( ! reset ) )
2011-01-10 19:49:11 +00:00
{
using ( SelectCustomer selectCustomer = new SelectCustomer ( new CustomerBI ( ) . GetFilteredCustomers , true ) )
{
selectCustomer . customerEvent + = new CustomerEventHandler ( selectCustomer_customerEvent ) ;
selectCustomer . ShowDialog ( ) ;
if ( selectCustomer . SelectedItem ! = null )
{
customer = selectCustomer . SelectedItem ;
saleForm . SetCustomerDisplay ( customer . Name ) ;
}
else
{
2011-01-30 07:14:05 +00:00
customer = new CustomerBI ( ) . GetCustomer ( 1 ) ;
2011-01-10 19:49:11 +00:00
}
}
}
else
{
2011-01-30 07:14:05 +00:00
customer = new CustomerBI ( ) . GetCustomer ( 1 ) ;
2011-01-10 19:49:11 +00:00
saleForm . SetCustomerDisplay ( customer . Name ) ;
}
}
#region Save
// if (btnWaiter.Tag == null)
2011-01-30 07:14:05 +00:00
//btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
2011-01-10 19:49:11 +00:00
2011-01-30 07:14:05 +00:00
public void Save ( bool print , int waiterID , string tableID )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
if ( print & & ! Session . IsAllowed ( RoleConstants . PRINT_BILL ) )
return ;
if ( ! print & & ! Session . IsAllowed ( RoleConstants . PRINT_KOT ) )
return ;
if ( ( billInfo ! = null ) & & ( SaleVoucherBI . IsBillPrinted ( billInfo . VoucherID ) ) & & ( ! Session . IsAllowed ( RoleConstants . EDIT_PRINTED_BILL ) ) )
return ;
if ( bill . Count = = 0 )
return ;
int? saved ;
if ( billInfo = = null )
saved = InsertVoucher ( print , waiterID , tableID ) ;
else
saved = UpdateSale ( print , waiterID , tableID ) ;
if ( saved . HasValue )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
if ( editVoucherID . HasValue )
saleForm . CloseWindow ( ) ;
2011-01-10 19:49:11 +00:00
else
2011-02-09 12:03:22 +00:00
PrintBill ( print , saved . Value ) ;
2011-01-10 19:49:11 +00:00
}
2011-02-09 12:03:22 +00:00
ClearBill ( ) ;
2011-01-10 19:49:11 +00:00
}
2011-02-09 12:03:22 +00:00
private int? InsertVoucher ( bool finalBill , int waiterID , string tableID )
2011-01-10 19:49:11 +00:00
{
if ( billInfo ! = null )
{
2011-02-09 12:03:22 +00:00
MessageBox . Show ( "Error in InsertVoucher, there is a previous sale in memory" , "Error" ) ;
2011-01-10 19:49:11 +00:00
return null ;
}
#region SaleVoucher
2011-01-30 07:14:05 +00:00
SaleVoucher saleVoucher = new SaleVoucher
2011-01-10 19:49:11 +00:00
{
2011-01-30 07:14:05 +00:00
Customer = customer ,
Settled = SettleOptionBI . GetSettleOption ( SettleOptionFactory . Unsettled ) ,
2011-01-10 19:49:11 +00:00
//Paid = finalBill,
TableID = tableID ,
2011-01-30 07:14:05 +00:00
Waiter = WaiterBI . GetWaiter ( waiterID ) ,
2011-01-10 19:49:11 +00:00
Printed = finalBill ,
Void = false ,
Date = DateTime . Now ,
Narration = "" ,
Ref = "" ,
Type = 'S' ,
2011-01-30 07:14:05 +00:00
User = Session . User
2011-01-10 19:49:11 +00:00
} ;
#endregion
#region Inventories
2011-01-30 07:14:05 +00:00
IList < Inventory > iList = GetInventoryForBill ( bill . Values ) ;
2011-01-10 19:49:11 +00:00
#endregion
2011-01-31 20:33:22 +00:00
SaleVoucherBI . Insert ( saleVoucher , iList ) ;
2011-01-10 19:49:11 +00:00
return saleVoucher . VoucherID ;
}
2011-01-30 07:14:05 +00:00
private int? UpdateSale ( bool finalBill , int waiterID , string tableID )
2011-01-10 19:49:11 +00:00
{
2011-01-30 07:14:05 +00:00
#region SaleVoucher
billInfo . User = Session . User ;
billInfo . Customer = customer ;
if ( ! billInfo . Printed & & finalBill )
billInfo . Date = null ;
billInfo . Printed = billInfo . Printed | | finalBill ;
billInfo . TableID = tableID ;
billInfo . Waiter = WaiterBI . GetWaiter ( waiterID ) ;
//if ((!billInfo.Printed) && finalBill)
// billInfo.Date = null;
billInfo . Inventories = new List < Inventory > ( ) ;
2011-01-10 19:49:11 +00:00
#endregion
#region Inventory
2011-01-30 07:14:05 +00:00
IList < Inventory > iList = GetInventoryForBill ( bill . Values ) ;
2011-01-10 19:49:11 +00:00
#endregion
2011-01-31 20:33:22 +00:00
SaleVoucherBI . Update ( billInfo , iList ) ;
2011-01-30 07:14:05 +00:00
return billInfo . VoucherID ;
}
private IList < Inventory > GetInventoryForBill ( ICollection < BillInventory > list )
{
Dictionary < int , Inventory > localList = new Dictionary < int , Inventory > ( ) ;
2011-02-09 12:03:22 +00:00
HashSet < int > keys = new HashSet < int > ( ) ;
2011-01-30 07:14:05 +00:00
foreach ( BillInventory item in list )
{
Inventory temp = new Inventory ( ) ;
if ( localList . ContainsKey ( item . ProductID ) )
{
2011-02-09 12:03:22 +00:00
if ( temp . Quantity < = 0 )
keys . Remove ( item . ProductID ) ;
2011-01-30 07:14:05 +00:00
temp = localList [ item . ProductID ] ;
temp . Quantity + = item . Quantity ;
2011-02-09 12:03:22 +00:00
temp . Amount + = item . Value ;
2011-01-31 20:33:22 +00:00
foreach ( var mod in item . Modifiers )
temp . InventoryModifier . Add ( new InventoryModifier ( ) { Modifier = mod } ) ;
2011-02-09 12:03:22 +00:00
if ( temp . Quantity < = 0 )
keys . Add ( item . ProductID ) ;
2011-01-30 07:14:05 +00:00
}
else
{
temp . Product = ProductBI . GetProduct ( item . ProductID ) ;
temp . Quantity = item . Quantity ;
temp . Rate = item . Price ;
2011-02-09 12:03:22 +00:00
temp . Discount = item . Discount ;
temp . ServiceCharge = item . ServiceCharge ;
2011-01-30 07:14:05 +00:00
temp . Tax = item . Tax ;
2011-02-09 12:03:22 +00:00
temp . Amount = item . Value ;
2011-01-31 20:33:22 +00:00
foreach ( var mod in item . Modifiers )
temp . InventoryModifier . Add ( new InventoryModifier ( ) { Modifier = mod } ) ;
2011-01-30 07:14:05 +00:00
localList . Add ( item . ProductID , temp ) ;
2011-02-09 12:03:22 +00:00
if ( item . Quantity < = 0 )
keys . Add ( item . ProductID ) ;
2011-01-30 07:14:05 +00:00
}
}
2011-02-09 12:03:22 +00:00
foreach ( var item in keys )
2011-01-30 07:14:05 +00:00
{
2011-02-09 12:03:22 +00:00
localList . Remove ( item ) ;
2011-01-30 07:14:05 +00:00
}
2011-02-09 12:03:22 +00:00
return localList . Values . ToList ( ) ;
2011-01-10 19:49:11 +00:00
}
#endregion
public void VoidBill ( )
{
2011-01-31 20:33:22 +00:00
if ( billInfo = = null )
return ;
if ( ! billInfo . Printed )
return ;
2011-02-09 12:03:22 +00:00
if ( Session . IsAllowed ( RoleConstants . VOID_BILL ) )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
if ( MessageBox . Show ( "Are you sure you want to void this bill?" , "Void Bill" , MessageBoxButtons . YesNo , MessageBoxIcon . Question , MessageBoxDefaultButton . Button2 ) = = DialogResult . Yes )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
SelectVoidReason voidReason = new SelectVoidReason ( GetVoidReason , true ) ;
voidReason . ShowDialog ( ) ;
if ( voidReason . SelectedItem ! = null )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
SaleVoucherBI . VoidBill ( billInfo . VoucherID , voidReason . SelectedItem . Description ) ;
ClearBill ( ) ;
}
else
{
MessageBox . Show ( "Please Select a reason if you want to void the bill" , "Bill NOT Voided" , MessageBoxButtons . OK , MessageBoxIcon . Asterisk ) ;
2011-01-10 19:49:11 +00:00
}
}
}
}
2011-01-30 07:14:05 +00:00
Customer selectCustomer_customerEvent ( object sender , CustomerEventArgs e )
2011-01-10 19:49:11 +00:00
{
using ( CustomersForm form = new CustomersForm ( e . CustomerID , e . Phone ) )
{
form . ShowDialog ( ) ;
return form . Customer ;
}
}
2011-01-30 07:14:05 +00:00
private void PrintBill ( bool finalBill , int voucherID )
2011-01-10 19:49:11 +00:00
{
if ( ! finalBill )
2011-01-17 14:55:43 +00:00
Accounts . Print . Thermal . PrintKot ( voucherID , bill . Values . ToList ( ) ) ;
2011-01-10 19:49:11 +00:00
else
2011-02-09 12:03:22 +00:00
Accounts . Print . Thermal . PrintBill ( voucherID , bill . Values . ToList ( ) ) ;
2011-01-10 19:49:11 +00:00
}
private List < StringType > GetVoidReason ( Dictionary < string , string > filter )
{
List < StringType > list = new List < StringType > ( ) ;
list . Add ( new StringType ( "Discount" ) ) ;
list . Add ( new StringType ( "Printing Fault" ) ) ;
list . Add ( new StringType ( "Item Changed" ) ) ;
list . Add ( new StringType ( "Quantity Reduced" ) ) ;
list . Add ( new StringType ( "Costing Bill for Party" ) ) ;
list . Add ( new StringType ( "Cashier Mistake" ) ) ;
list . Add ( new StringType ( "Management Freesale" ) ) ;
list . Add ( new StringType ( "Other" ) ) ;
return list . Where ( i = > i . Description . ToLower ( ) . Contains ( filter [ "Name" ] . ToLower ( ) . Trim ( ) ) ) . ToList ( ) ;
}
2011-01-30 07:14:05 +00:00
public BillInventory CurrentProduct
2011-01-10 19:49:11 +00:00
{
2011-01-30 07:14:05 +00:00
get
{
2011-02-09 12:03:22 +00:00
if ( saleForm . BindingSource . Position = = - 1 )
return null ;
else
return bill . ElementAt ( saleForm . BindingSource . Position ) . Value ;
2011-01-30 07:14:05 +00:00
}
2011-01-10 19:49:11 +00:00
}
private void ShowAmount ( )
{
2011-01-30 07:14:05 +00:00
//saleForm.BindingSource.CurrencyManager.Position = 1;
2011-01-17 14:55:43 +00:00
decimal taxAmount = bill . Values . Sum ( b = > b . TaxAmount ) ;
decimal discountAmount = bill . Values . Sum ( b = > b . DiscountAmount ) ;
2011-01-10 19:49:11 +00:00
decimal grossAmount = bill . Values . Sum ( b = > b . GrossAmount ) ;
2011-01-17 14:55:43 +00:00
decimal valueAmount = bill . Values . Sum ( b = > b . Value ) ;
decimal serviceChargeAmount = bill . Values . Sum ( b = > b . ServiceChargeAmount ) ;
2011-01-10 19:49:11 +00:00
//bill.Values.ToList();
2011-01-17 14:55:43 +00:00
saleForm . ShowAmount ( discountAmount , grossAmount , serviceChargeAmount , taxAmount , valueAmount , bill . Values . ToList ( ) ) ;
2011-01-10 19:49:11 +00:00
}
2011-02-09 12:03:22 +00:00
public void ProductRemove ( )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
var item = CurrentProduct ;
if ( ! Allowed ( item ) )
2011-01-30 07:14:05 +00:00
return ;
2011-02-09 12:03:22 +00:00
if ( item . Printed > 0 )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
if ( ! Session . IsAllowed ( RoleConstants . EDIT_PRINTED_PRODUCT ) )
return ;
else if ( MessageBox . Show ( string . Format ( "Already {0} items have been printed.\n\rAre you sure you want to delete this item?" , item . Printed ) , "Delete" , MessageBoxButtons . YesNo , MessageBoxIcon . Question ) = = DialogResult . No )
return ;
2011-01-10 19:49:11 +00:00
}
2011-02-09 12:03:22 +00:00
bill . Remove ( new BillItemKey ( item . ProductID , item . Printed = = 0 ) ) ;
2011-02-04 19:30:55 +00:00
bill . ReCompact ( ) ;
2011-01-30 07:14:05 +00:00
ShowAmount ( ) ;
2011-01-10 19:49:11 +00:00
}
2011-01-30 07:14:05 +00:00
2011-02-09 12:03:22 +00:00
public void SetQuantity ( decimal quantity , bool prompt )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
var item = CurrentProduct ;
if ( ! Allowed ( item ) )
2011-01-10 19:49:11 +00:00
return ;
2011-02-09 12:03:22 +00:00
new BillHelperFunctions ( saleForm . BindingSource , bill , CurrentProduct . ProductID ) . SetQuantity ( item , quantity , prompt ) ;
2011-01-10 19:49:11 +00:00
ShowAmount ( ) ;
}
2011-01-30 07:14:05 +00:00
public void ChangeRate ( )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
new BillHelperFunctions ( saleForm . BindingSource , bill , CurrentProduct . ProductID ) . SetPrice ( CurrentProduct ) ;
ShowAmount ( ) ;
2011-01-10 19:49:11 +00:00
}
2011-02-09 12:03:22 +00:00
private bool Allowed ( BillInventory item , RoleConstants role )
{
if ( item = = null )
return false ;
if ( ! Session . IsAllowed ( role ) )
return false ;
return true ;
}
private bool Allowed ( BillInventory item )
{ return item ! = null ; }
2011-01-10 19:49:11 +00:00
private void InputBox_Validating ( object sender , InputBoxValidatingArgs e )
{
}
2011-01-30 07:14:05 +00:00
private void LoadBill ( int voucherID )
2011-01-10 19:49:11 +00:00
{
ClearBill ( ) ;
2011-01-30 07:14:05 +00:00
IList < Inventory > iList = new List < Inventory > ( ) ;
2011-01-31 20:33:22 +00:00
SaleVoucherBI . GetSaleVoucher ( voucherID , out billInfo , out iList ) ;
2011-01-10 19:49:11 +00:00
2011-01-30 07:14:05 +00:00
this . customer = billInfo . Customer ;
saleForm . ShowInfo ( billInfo . BillID , billInfo . KotID , billInfo . CreationDate , billInfo . Date . Value , billInfo . LastEditDate , customer . Name , billInfo . TableID , billInfo . Waiter . WaiterID , billInfo . Waiter . Name ) ;
2011-01-10 19:49:11 +00:00
2011-01-30 07:14:05 +00:00
foreach ( Inventory inventory in iList )
2011-01-10 19:49:11 +00:00
{
2011-01-31 20:33:22 +00:00
BillItemKey key = new BillItemKey ( inventory . Product . ProductID , false ) ;
var product = ProductBI . GetProduct ( inventory . Product . ProductID ) ;
2011-01-30 07:14:05 +00:00
var item = new BillInventory
2011-01-10 19:49:11 +00:00
{
2011-01-31 20:33:22 +00:00
ProductID = product . ProductID ,
2011-01-30 07:14:05 +00:00
Discount = inventory . Discount ,
2011-01-31 20:33:22 +00:00
Name = product . Units = = string . Empty ? product . Name : product . Name + " (" + product . Units + ")" ,
2011-01-30 07:14:05 +00:00
Price = inventory . Rate ,
Printed = inventory . Quantity ,
Quantity = inventory . Quantity ,
Tax = inventory . Tax ,
ServiceCharge = inventory . ServiceCharge ,
} ;
foreach ( var mod in inventory . InventoryModifier )
item . Modifiers . Add ( mod . Modifier ) ;
bill . Add ( key , item ) ;
2011-01-10 19:49:11 +00:00
}
ShowAmount ( ) ;
}
2011-01-13 20:21:02 +00:00
public void LoadBillFromTable ( string tableName )
2011-01-10 19:49:11 +00:00
{
2011-01-13 20:21:02 +00:00
if ( ! string . IsNullOrEmpty ( tableName ) )
2011-01-10 19:49:11 +00:00
{
2011-01-31 20:33:22 +00:00
SaleVoucher voucher = SaleVoucherBI . GetPendingVoucherID ( tableName ) ;
2011-01-30 07:14:05 +00:00
if ( voucher ! = null )
2011-01-10 19:49:11 +00:00
{
2011-01-30 07:14:05 +00:00
LoadBill ( voucher . VoucherID ) ;
2011-01-13 20:21:02 +00:00
}
}
else
{
2011-01-31 20:33:22 +00:00
InputBoxResult result = InputBox . Show ( "Table Number" , "0" , InputBox_Validating ) ;
2011-01-13 20:21:02 +00:00
if ( result . OK )
{
string tableID = result . Text . Trim ( ) ;
if ( ( tableID ! = "C" ) & & ( tableID ! = "" ) & & ( ! tableID . Contains ( "." ) ) )
2011-01-10 19:49:11 +00:00
{
2011-01-31 20:33:22 +00:00
SaleVoucher voucher = SaleVoucherBI . GetPendingVoucherID ( tableName ) ;
2011-01-30 07:14:05 +00:00
if ( voucher ! = null )
2011-01-13 20:21:02 +00:00
{
2011-01-30 07:14:05 +00:00
LoadBill ( voucher . VoucherID ) ;
2011-01-13 20:21:02 +00:00
}
2011-01-10 19:49:11 +00:00
}
2011-01-13 20:21:02 +00:00
else
ClearBill ( ) ;
2011-01-10 19:49:11 +00:00
}
}
}
public void CancelBillChanges ( )
{
2011-02-09 12:03:22 +00:00
if ( bill . Count ! = 0 & & bill . Values . Any ( i = > i . Printed ! = i . Quantity ) )
if ( MessageBox . Show ( "Abandon Changes?" , "Abandon Changes" , MessageBoxButtons . YesNo , MessageBoxIcon . Question , MessageBoxDefaultButton . Button2 ) = = DialogResult . No )
2011-01-10 19:49:11 +00:00
return ;
ClearBill ( ) ;
}
public void ClearBill ( )
{
billInfo = null ;
ShowCustomerList ( true ) ;
bill . Clear ( ) ;
saleForm . ClearBill ( bill ) ;
}
public void FormLoad ( )
{
2011-02-09 12:03:22 +00:00
if ( editVoucherID . HasValue )
2011-01-10 19:49:11 +00:00
{
2011-02-09 12:03:22 +00:00
LoadBill ( editVoucherID . Value ) ;
2011-01-10 19:49:11 +00:00
}
}
2011-01-17 14:55:43 +00:00
internal void SettleBill ( )
{
if ( billInfo = = null )
return ;
2011-01-31 20:33:22 +00:00
if ( ! billInfo . Printed )
return ;
2011-02-09 12:03:22 +00:00
if ( ! Session . IsAllowed ( RoleConstants . SETTLE_BILL ) )
return ;
2011-01-30 07:14:05 +00:00
int option = SettleOptionFactory . Unsettled ;
2011-01-17 14:55:43 +00:00
using ( BillSettleForm frm = new BillSettleForm ( ) )
{
frm . ShowDialog ( ) ;
option = frm . optionChosen ;
}
2011-01-30 07:14:05 +00:00
if ( option ! = SettleOptionFactory . Unsettled )
2011-01-17 14:55:43 +00:00
{
2011-01-31 20:33:22 +00:00
SaleVoucherBI . SettleVoucher ( Session . User , billInfo . VoucherID , option ) ;
2011-01-30 07:14:05 +00:00
ClearBill ( ) ;
2011-01-17 14:55:43 +00:00
}
}
2011-01-10 19:49:11 +00:00
}
}
// How to load a bill
2011-02-09 12:03:22 +00:00
//LoadBill(((PendingBills)bsPending.Current).editVoucherID);
2011-01-10 19:49:11 +00:00
// ChangeFormState(SaleFormState.Billing);