SgWindow.ShowModalDialog<ReceiptActionPages.IssueReceiptBasedOnTourDialog>("", "IssueReceiptBasedOnTourDialog", null, null, "height:380,width:750,visibleStatusbar:false");
ExecutionContext.Current.Executable.OnCallBack(
() =>
{
if (ExecutionContext.Current.Executable.Response.Dialogs[0] != null)
{
var returnedValues = (object[])ExecutionContext.Current.Executable.Response.Dialogs[0];
if (returnedValues[0] != null && returnedValues[1] != null)
{
var tourID = long.Parse(returnedValues[0].ToString());
var transformationType = (TourToReceiptTransformationType)returnedValues[1];
var receiptType = (TourToReceiptTransformationReceiptType)returnedValues[2];
Receipt receipt = new Receipt();
Tour tour = ServiceFactory.Create<IOperationsService>().FetchAllTours().Where(t => t.ID == tourID).FirstOrDefault();
var transformer = new TourToReceiptTransformer();
transformer.Transform(tour, receipt, transformationType, receiptType);
var key = ShortTermSessionState.Current.Add(receipt);
SgShell.Show(typeof(SystemGroup.ReceiptAndPayment.ReceiptManagement.Web.ReceiptPages.Default), string.Format("{0}={1}", SgEditorPageHelper.EntityInstanceKeyParameterName, key));
}
}
}
);
function onClose(evt) {
var tourID = $find("sltTour").get_selectedID();
if (!tourID)
throw Error.create("تور انتخاب نشده است.");
var tourToReceiptTransformationType = 1;
if ($get("srbInvoiceRelatedReceiptMoneyInfos").checked)
tourToReceiptTransformationType = 2;
if ($get("srbNonInvoiceRelatedReceiptMoneyInfos").checked)
tourToReceiptTransformationType = 3;
var receiptType = 0;
if ($get("chkCashe").checked)
receiptType |= 1;
if ($get("chkCheque").checked)
receiptType |= 2;
if ($get("chkReseiptDeposit").checked)
receiptType |= 4;
createCookie("TourReceiptInvoiceTransformationType", tourToReceiptTransformationType);
createCookie("TourReceiptInvoiceReceiptType", receiptType);
var res = new Array(tourID, tourToReceiptTransformationType, receiptType);
Sg.Window.getCurrent().close(res);
return SgCancelBrowserEvent(evt);
}