<?php
//Aworks.org/licence.html.
// Produced by Webdiscount Technologies(Kenya) under Contract
// No. KSL/CONSULT.GEN/1 with the The Kenya National Federation of Agricultural Producers(KENFAP) and in collaboration with Food and Agriculture Organization
// of the United Nations (FAO), Agriculturathe Ministry of
// Co-operative Development and Marketing (Kenya) and piloted at Wamunyu Dairy Cooperative Society(Kenya) and Ololaiser Dairy Farmers Cooperative Society(Kenya).
//Include Common Files @1-CCAFBE82
define("RelativePath", ".");
define("PathToCurrentPage", "/");
define("FileName", "CA_PaymentVoucher_Edit.php");
include(RelativePath . "/Common.php");
include(RelativePath . "/Template.php");
include(RelativePath . "/Sorter.php");
include(RelativePath . "/Navigator.php");
include(RelativePath . "/sm_submenucontrol.php");
//End Include Common Files
class clsRecordcashtranSearch { //cashtranSearch Class @3-83145552
//Variables @3-D6FF3E86
// Public variables
var $ComponentType = "Record";
var $ComponentName;
var $Parent;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormEnctype;
var $Visible;
var $IsEmpty;
var $CCSEvents = "";
var $CCSEventResult;
var $RelativePath = "";
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $EditMode = false;
var $ds;
var $DataSource;
var $ValidatingControls;
var $Controls;
var $Attributes;
// Class variables
//End Variables
//Class_Initialize Event @3-01B794FB
function clsRecordcashtranSearch($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record cashtranSearch/Error";
$this->ReadAllowed = true;
$this->Visible = (CCSecurityAccessCheck("1;2;3") == "success");
if($this->Visible)
{
$this->ReadAllowed = $this->ReadAllowed && CCUserInGroups(CCGetGroupID(), "1;2;3");
$this->ComponentName = "cashtranSearch";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($FormName == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->s_EntryId = & new clsControl(ccsListBox, "s_EntryId", "s_EntryId", ccsText, "", CCGetRequestParam("s_EntryId", $Method, NULL), $this);
$this->s_EntryId->DSType = dsListOfValues;
$this->s_EntryId->Values = array(array("RC", "Receipt"), array("PA", "Payment"));
$this->s_RefNbr = & new clsControl(ccsListBox, "s_RefNbr", "s_RefNbr", ccsText, "", CCGetRequestParam("s_RefNbr", $Method, NULL), $this);
$this->s_RefNbr->DSType = dsTable;
$this->s_RefNbr->DataSource = new clsDBCoopWorksConn();
$this->s_RefNbr->ds = & $this->s_RefNbr->DataSource;
$this->s_RefNbr->DataSource->SQL = "SELECT * \n" .
"FROM cashtran {SQL_Where} {SQL_OrderBy}";
list($this->s_RefNbr->BoundColumn, $this->s_RefNbr->TextColumn, $this->s_RefNbr->DBFormat) = array("RefNbr", "RefNbr", "");
$this->s_TranDate = & new clsControl(ccsTextBox, "s_TranDate", "s_TranDate", ccsDate, $DefaultDateFormat, CCGetRequestParam("s_TranDate", $Method, NULL), $this);
$this->s_PayType = & new clsControl(ccsListBox, "s_PayType", "s_PayType", ccsText, "", CCGetRequestParam("s_PayType", $Method, NULL), $this);
$this->s_PayType->DSType = dsListOfValues;
$this->s_PayType->Values = array(array("CSH", "Cash"), array("CHQ", "Cheque"));
$this->s_ChqNbr = & new clsControl(ccsTextBox, "s_ChqNbr", "s_ChqNbr", ccsText, "", CCGetRequestParam("s_ChqNbr", $Method, NULL), $this);
$this->s_TranDesc = & new clsControl(ccsTextBox, "s_TranDesc", "s_TranDesc", ccsText, "", CCGetRequestParam("s_TranDesc", $Method, NULL), $this);
$this->Button_DoSearch = & new clsButton("Button_DoSearch", $Method, $this);
$this->DatePicker_s_TranDate1 = & new clsDatePicker("DatePicker_s_TranDate1", "cashtranSearch", "s_TranDate", $this);
}
}
//End Class_Initialize Event
//Validate Method @3-B2B6B262
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->s_EntryId->Validate() && $Validation);
$Validation = ($this->s_RefNbr->Validate() && $Validation);
$Validation = ($this->s_TranDate->Validate() && $Validation);
$Validation = ($this->s_PayType->Validate() && $Validation);
$Validation = ($this->s_ChqNbr->Validate() && $Validation);
$Validation = ($this->s_TranDesc->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
$Validation = $Validation && ($this->s_EntryId->Errors->Count() == 0);
$Validation = $Validation && ($this->s_RefNbr->Errors->Count() == 0);
$Validation = $Validation && ($this->s_TranDate->Errors->Count() == 0);
$Validation = $Validation && ($this->s_PayType->Errors->Count() == 0);
$Validation = $Validation && ($this->s_ChqNbr->Errors->Count() == 0);
$Validation = $Validation && ($this->s_TranDesc->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @3-B6673BA7
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->s_EntryId->Errors->Count());
$errors = ($errors || $this->s_RefNbr->Errors->Count());
$errors = ($errors || $this->s_TranDate->Errors->Count());
$errors = ($errors || $this->s_PayType->Errors->Count());
$errors = ($errors || $this->s_ChqNbr->Errors->Count());
$errors = ($errors || $this->s_TranDesc->Errors->Count());
$errors = ($errors || $this->DatePicker_s_TranDate1->Errors->Count());
$errors = ($errors || $this->Errors->Count());
return $errors;
}
//End CheckErrors Method
//MasterDetail @3-ED598703
function SetPrimaryKeys($keyArray)
{
$this->PrimaryKeys = $keyArray;
}
function GetPrimaryKeys()
{
return $this->PrimaryKeys;
}
function GetPrimaryKey($keyName)
{
return $this->PrimaryKeys[$keyName];
}
//End MasterDetail
//Operation Method @3-DF487295
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
if(!$this->FormSubmitted) {
return;
}
if($this->FormSubmitted) {
$this->PressedButton = "Button_DoSearch";
if($this->Button_DoSearch->Pressed) {
$this->PressedButton = "Button_DoSearch";
}
}
$Redirect = "CA_PaymentVoucher_Edit.php";
if($this->Validate()) {
if($this->PressedButton == "Button_DoSearch") {
$Redirect = "CA_PaymentVoucher_Edit.php" . "?" . CCMergeQueryStrings(CCGetQueryString("Form", array("Button_DoSearch", "Button_DoSearch_x", "Button_DoSearch_y")));
if(!CCGetEvent($this->Button_DoSearch->CCSEvents, "OnClick", $this->Button_DoSearch)) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//Show Method @3-9752C417
function Show()
{
global $CCSUseAmp;
global $Tpl;
global $FileName;
global $CCSLocales;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->s_EntryId->Prepare();
$this->s_RefNbr->Prepare();
$this->s_PayType->Prepare();
$RecordBlock = "Record " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $RecordBlock;
$this->EditMode = $this->EditMode && $this->ReadAllowed;
if (!$this->FormSubmitted) {
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error = "";
$Error = ComposeStrings($Error, $this->s_EntryId->Errors->ToString());
$Error = ComposeStrings($Error, $this->s_RefNbr->Errors->ToString());
$Error = ComposeStrings($Error, $this->s_TranDate->Errors->ToString());
$Error = ComposeStrings($Error, $this->s_PayType->Errors->ToString());
$Error = ComposeStrings($Error, $this->s_ChqNbr->Errors->ToString());
$Error = ComposeStrings($Error, $this->s_TranDesc->Errors->ToString());
$Error = ComposeStrings($Error, $this->DatePicker_s_TranDate1->Errors->ToString());
$Error = ComposeStrings($Error, $this->Errors->ToString());
$Tpl->SetVar("Error", $Error);
$Tpl->Parse("Error", false);
}
$CCSForm = $this->EditMode ? $this->ComponentName . ":" . "Edit" : $this->ComponentName;
$this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $CCSForm);
$Tpl->SetVar("Action", !$CCSUseAmp ? $this->HTMLFormAction : str_replace("&", "&", $this->HTMLFormAction));
$Tpl->SetVar("HTMLFormName", $this->ComponentName);
$Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
$this->Attributes->Show();
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$this->s_EntryId->Show();
$this->s_RefNbr->Show();
$this->s_TranDate->Show();
$this->s_PayType->Show();
$this->s_ChqNbr->Show();
$this->s_TranDesc->Show();
$this->Button_DoSearch->Show();
$this->DatePicker_s_TranDate1->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
}
//End Show Method
} //End cashtranSearch Class @3-FCB6E20C
class clsGridcashtran { //cashtran class @2-8FA9D89A
//Variables @2-B8F2F0C4
// Public variables
var $ComponentType = "Grid";
var $ComponentName;
var $Visible;
var $Errors;
var $ErrorBlock;
var $ds;
var $DataSource;
var $PageSize;
var $IsEmpty;
var $ForceIteration = false;
var $HasRecord = false;
var $SorterName = "";
var $SorterDirection = "";
var $PageNumber;
var $RowNumber;
var $ControlsVisible = array();
var $CCSEvents = "";
var $CCSEventResult;
var $RelativePath = "";
var $Attributes;
// Grid Controls
var $StaticControls;
var $RowControls;
var $Sorter1;
var $Sorter2;
var $Sorter3;
var $Sorter4;
var $Sorter5;
var $Sorter6;
var $Sorter7;
var $Sorter8;
var $Sorter9;
//End Variables
//Class_Initialize Event @2-4B32A993
function clsGridcashtran($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->ComponentName = "cashtran";
$this->Visible = True;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid cashtran";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$this->DataSource = new clscashtranDataSource($this);
$this->ds = & $this->DataSource;
$this->PageSize = CCGetParam($this->ComponentName . "PageSize", "");
if(!is_numeric($this->PageSize) || !strlen($this->PageSize))
$this->PageSize = 50;
else
$this->PageSize = intval($this->PageSize);
if ($this->PageSize > 100)
$this->PageSize = 100;
if($this->PageSize == 0)
$this->Errors->addError("<p>Form: Grid " . $this->ComponentName . "<br>Error: (CCS06) Invalid page size.</p>");
$this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1));
if ($this->PageNumber <= 0) $this->PageNumber = 1;
$this->Visible = (CCSecurityAccessCheck("1;2;3") == "success");
$this->SorterName = CCGetParam("cashtranOrder", "");
$this->SorterDirection = CCGetParam("cashtranDir", "");
$this->RefNbr = & new clsControl(ccsLink, "RefNbr", "RefNbr", ccsText, "", CCGetRequestParam("RefNbr", ccsGet, NULL), $this);
$this->RefNbr->Page = "CA_PaymentVoucher_Edit.php";
$this->DrCr = & new clsControl(ccsLabel, "DrCr", "DrCr", ccsText, "", CCGetRequestParam("DrCr", ccsGet, NULL), $this);
$this->Acct = & new clsControl(ccsLabel, "Acct", "Acct", ccsText, "", CCGetRequestParam("Acct", ccsGet, NULL), $this);
$this->Sub = & new clsControl(ccsLabel, "Sub", "Sub", ccsText, "", CCGetRequestParam("Sub", ccsGet, NULL), $this);
$this->TranDate = & new clsControl(ccsLabel, "TranDate", "TranDate", ccsDate, $DefaultDateFormat, CCGetRequestParam("TranDate", ccsGet, NULL), $this);
$this->TranDesc = & new clsControl(ccsLabel, "TranDesc", "TranDesc", ccsText, "", CCGetRequestParam("TranDesc", ccsGet, NULL), $this);
$this->TranAmt = & new clsControl(ccsLabel, "TranAmt", "TranAmt", ccsFloat, "", CCGetRequestParam("TranAmt", ccsGet, NULL), $this);
$this->ChqNbr = & new clsControl(ccsLabel, "ChqNbr", "ChqNbr", ccsText, "", CCGetRequestParam("ChqNbr", ccsGet, NULL), $this);
$this->PayType = & new clsControl(ccsLabel, "PayType", "PayType", ccsText, "", CCGetRequestParam("PayType", ccsGet, NULL), $this);
$this->cashtran_Insert = & new clsControl(ccsLink, "cashtran_Insert", "cashtran_Insert", ccsText, "", CCGetRequestParam("cashtran_Insert", ccsGet, NULL), $this);
$this->cashtran_Insert->Parameters = CCGetQueryString("QueryString", array("RecId", "ccsForm"));
$this->cashtran_Insert->Page = "CA_PaymentVoucher_Edit.php";
$this->Navigator = & new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpCentered, $this);
$this->Navigator->PageSizes = array("1", "5", "10", "25", "50");
$this->Sorter1 = & new clsSorter($this->ComponentName, "Sorter1", $FileName, $this);
$this->Sorter2 = & new clsSorter($this->ComponentName, "Sorter2", $FileName, $this);
$this->Sorter3 = & new clsSorter($this->ComponentName, "Sorter3", $FileName, $this);
$this->Sorter4 = & new clsSorter($this->ComponentName, "Sorter4", $FileName, $this);
$this->Sorter5 = & new clsSorter($this->ComponentName, "Sorter5", $FileName, $this);
$this->Sorter6 = & new clsSorter($this->ComponentName, "Sorter6", $FileName, $this);
$this->Sorter7 = & new clsSorter($this->ComponentName, "Sorter7", $FileName, $this);
$this->Sorter8 = & new clsSorter($this->ComponentName, "Sorter8", $FileName, $this);
$this->Sorter9 = & new clsSorter($this->ComponentName, "Sorter9", $FileName, $this);
}
//End Class_Initialize Event
//Initialize Method @2-90E704C5
function Initialize()
{
if(!$this->Visible) return;
$this->DataSource->PageSize = & $this->PageSize;
$this->DataSource->AbsolutePage = & $this->PageNumber;
$this->DataSource->SetOrder($this->SorterName, $this->SorterDirection);
}
//End Initialize Method
//Show Method @2-E7C41C09
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$this->RowNumber = 0;
$this->DataSource->Parameters["urls_EntryId"] = CCGetFromGet("s_EntryId", NULL);
$this->DataSource->Parameters["urls_RefNbr"] = CCGetFromGet("s_RefNbr", NULL);
$this->DataSource->Parameters["urls_TranDate"] = CCGetFromGet("s_TranDate", NULL);
$this->DataSource->Parameters["urls_PayType"] = CCGetFromGet("s_PayType", NULL);
$this->DataSource->Parameters["urls_ChqNbr"] = CCGetFromGet("s_ChqNbr", NULL);
$this->DataSource->Parameters["urls_TranDesc"] = CCGetFromGet("s_TranDesc", NULL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->DataSource->Prepare();
$this->DataSource->Open();
$this->HasRecord = $this->DataSource->has_next_record();
$this->IsEmpty = ! $this->HasRecord;
$this->Attributes->Show();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
if(!$this->Visible) return;
$GridBlock = "Grid " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
if (!$this->IsEmpty) {
$this->ControlsVisible["RefNbr"] = $this->RefNbr->Visible;
$this->ControlsVisible["DrCr"] = $this->DrCr->Visible;
$this->ControlsVisible["Acct"] = $this->Acct->Visible;
$this->ControlsVisible["Sub"] = $this->Sub->Visible;
$this->ControlsVisible["TranDate"] = $this->TranDate->Visible;
$this->ControlsVisible["TranDesc"] = $this->TranDesc->Visible;
$this->ControlsVisible["TranAmt"] = $this->TranAmt->Visible;
$this->ControlsVisible["ChqNbr"] = $this->ChqNbr->Visible;
$this->ControlsVisible["PayType"] = $this->PayType->Visible;
while ($this->ForceIteration || (($this->RowNumber < $this->PageSize) && ($this->HasRecord = $this->DataSource->has_next_record()))) {
$this->RowNumber++;
if ($this->HasRecord) {
$this->DataSource->next_record();
$this->DataSource->SetValues();
}
$Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row";
$this->RefNbr->SetValue($this->DataSource->RefNbr->GetValue());
$this->RefNbr->Parameters = CCGetQueryString("QueryString", array("ccsForm"));
$this->RefNbr->Parameters = CCAddParam($this->RefNbr->Parameters, "RefNbr", $this->DataSource->f("RefNbr"));
$this->DrCr->SetValue($this->DataSource->DrCr->GetValue());
$this->Acct->SetValue($this->DataSource->Acct->GetValue());
$this->Sub->SetValue($this->DataSource->Sub->GetValue());
$this->TranDate->SetValue($this->DataSource->TranDate->GetValue());
$this->TranDesc->SetValue($this->DataSource->TranDesc->GetValue());
$this->TranAmt->SetValue($this->DataSource->TranAmt->GetValue());
$this->ChqNbr->SetValue($this->DataSource->ChqNbr->GetValue());
$this->PayType->SetValue($this->DataSource->PayType->GetValue());
$this->Attributes->SetValue("rowNumber", $this->RowNumber);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this);
$this->Attributes->Show();
$this->RefNbr->Show();
$this->DrCr->Show();
$this->Acct->Show();
$this->Sub->Show();
$this->TranDate->Show();
$this->TranDesc->Show();
$this->TranAmt->Show();
$this->ChqNbr->Show();
$this->PayType->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parse("Row", true);
}
}
else { // Show NoRecords block if no records are found
$this->Attributes->Show();
$Tpl->parse("NoRecords", false);
}
$errors = $this->GetErrors();
if(strlen($errors))
{
$Tpl->replaceblock("", $errors);
$Tpl->block_path = $ParentPath;
return;
}
$this->Navigator->PageNumber = $this->DataSource->AbsolutePage;
$this->Navigator->PageSize = $this->PageSize;
if ($this->DataSource->RecordsCount == "CCS not counted")
$this->Navigator->TotalPages = $this->DataSource->AbsolutePage + ($this->DataSource->next_record() ? 1 : 0);
else
$this->Navigator->TotalPages = $this->DataSource->PageCount();
if ($this->Navigator->TotalPages <= 1) {
$this->Navigator->Visible = false;
}
$this->cashtran_Insert->Show();
$this->Navigator->Show();
$this->Sorter1->Show();
$this->Sorter2->Show();
$this->Sorter3->Show();
$this->Sorter4->Show();
$this->Sorter5->Show();
$this->Sorter6->Show();
$this->Sorter7->Show();
$this->Sorter8->Show();
$this->Sorter9->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
//GetErrors Method @2-48DBCE10
function GetErrors()
{
$errors = "";
$errors = ComposeStrings($errors, $this->RefNbr->Errors->ToString());
$errors = ComposeStrings($errors, $this->DrCr->Errors->ToString());
$errors = ComposeStrings($errors, $this->Acct->Errors->ToString());
$errors = ComposeStrings($errors, $this->Sub->Errors->ToString());
$errors = ComposeStrings($errors, $this->TranDate->Errors->ToString());
$errors = ComposeStrings($errors, $this->TranDesc->Errors->ToString());
$errors = ComposeStrings($errors, $this->TranAmt->Errors->ToString());
$errors = ComposeStrings($errors, $this->ChqNbr->Errors->ToString());
$errors = ComposeStrings($errors, $this->PayType->Errors->ToString());
$errors = ComposeStrings($errors, $this->Errors->ToString());
$errors = ComposeStrings($errors, $this->DataSource->Errors->ToString());
return $errors;
}
//End GetErrors Method
} //End cashtran Class @2-FCB6E20C
class clscashtranDataSource extends clsDBCoopWorksConn { //cashtranDataSource Class @2-A0F97033
//DataSource Variables @2-C314B7BA
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $CountSQL;
var $wp;
// Datasource fields
var $RefNbr;
var $DrCr;
var $Acct;
var $Sub;
var $TranDate;
var $TranDesc;
var $TranAmt;
var $ChqNbr;
var $PayType;
//End DataSource Variables
//DataSourceClass_Initialize Event @2-E48A88F4
function clscashtranDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Grid cashtran";
$this->Initialize();
$this->RefNbr = new clsField("RefNbr", ccsText, "");
$this->DrCr = new clsField("DrCr", ccsText, "");
$this->Acct = new clsField("Acct", ccsText, "");
$this->Sub = new clsField("Sub", ccsText, "");
$this->TranDate = new clsField("TranDate", ccsDate, $this->DateFormat);
$this->TranDesc = new clsField("TranDesc", ccsText, "");
$this->TranAmt = new clsField("TranAmt", ccsFloat, "");
$this->ChqNbr = new clsField("ChqNbr", ccsText, "");
$this->PayType = new clsField("PayType", ccsText, "");
}
//End DataSourceClass_Initialize Event
//SetOrder Method @2-EBD177BD
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
array("Sorter1" => array("RefNbr", ""),
"Sorter2" => array("DrCr", ""),
"Sorter3" => array("Acct", ""),
"Sorter4" => array("Sub", ""),
"Sorter5" => array("TranDate", ""),
"Sorter6" => array("TranDesc", ""),
"Sorter7" => array("TranAmt", ""),
"Sorter8" => array("ChqNbr", ""),
"Sorter9" => array("PayType", "")));
}
//End SetOrder Method
//Prepare Method @2-42BC009F
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_EntryId", ccsText, "", "", $this->Parameters["urls_EntryId"], "", false);
$this->wp->AddParameter("2", "urls_RefNbr", ccsText, "", "", $this->Parameters["urls_RefNbr"], "", false);
$this->wp->AddParameter("3", "urls_TranDate", ccsDate, $DefaultDateFormat, $this->DateFormat, $this->Parameters["urls_TranDate"], "", false);
$this->wp->AddParameter("4", "urls_PayType", ccsText, "", "", $this->Parameters["urls_PayType"], "", false);
$this->wp->AddParameter("5", "urls_ChqNbr", ccsText, "", "", $this->Parameters["urls_ChqNbr"], "", false);
$this->wp->AddParameter("6", "urls_TranDesc", ccsText, "", "", $this->Parameters["urls_TranDesc"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "EntryId", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsText),false);
$this->wp->Criterion[2] = $this->wp->Operation(opContains, "RefNbr", $this->wp->GetDBValue("2"), $this->ToSQL($this->wp->GetDBValue("2"), ccsText),false);
$this->wp->Criterion[3] = $this->wp->Operation(opEqual, "TranDate", $this->wp->GetDBValue("3"), $this->ToSQL($this->wp->GetDBValue("3"), ccsDate),false);
$this->wp->Criterion[4] = $this->wp->Operation(opContains, "PayType", $this->wp->GetDBValue("4"), $this->ToSQL($this->wp->GetDBValue("4"), ccsText),false);
$this->wp->Criterion[5] = $this->wp->Operation(opContains, "ChqNbr", $this->wp->GetDBValue("5"), $this->ToSQL($this->wp->GetDBValue("5"), ccsText),false);
$this->wp->Criterion[6] = $this->wp->Operation(opContains, "TranDesc", $this->wp->GetDBValue("6"), $this->ToSQL($this->wp->GetDBValue("6"), ccsText),false);
$this->Where = $this->wp->opAND(
false, $this->wp->opAND(
false, $this->wp->opAND(
false, $this->wp->opAND(
false, $this->wp->opAND(
false,
$this->wp->Criterion[1],
$this->wp->Criterion[2]),
$this->wp->Criterion[3]),
$this->wp->Criterion[4]),
$this->wp->Criterion[5]),
$this->wp->Criterion[6]);
}
//End Prepare Method
//Open Method @2-44CBA83A
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->CountSQL = "SELECT COUNT(*)\n\n" .
"FROM cashtran";
$this->SQL = "SELECT RecId, Acct, Sub, TranDate, TranDesc, TranAmt, ChqNbr, PayType, DrCr, RefNbr \n\n" .
"FROM cashtran {SQL_Where} {SQL_OrderBy}";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
if ($this->CountSQL)
$this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);
else
$this->RecordsCount = "CCS not counted";
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
}
//End Open Method
//SetValues Method @2-F91A0409
function SetValues()
{
$this->RefNbr->SetDBValue($this->f("RefNbr"));
$this->DrCr->SetDBValue($this->f("DrCr"));
$this->Acct->SetDBValue($this->f("Acct"));
$this->Sub->SetDBValue($this->f("Sub"));
$this->TranDate->SetDBValue(trim($this->f("TranDate")));
$this->TranDesc->SetDBValue($this->f("TranDesc"));
$this->TranAmt->SetDBValue(trim($this->f("TranAmt")));
$this->ChqNbr->SetDBValue($this->f("ChqNbr"));
$this->PayType->SetDBValue($this->f("PayType"));
}
//End SetValues Method
} //End cashtranDataSource Class @2-FCB6E20C
class clsRecordcashtran1 { //cashtran1 Class @51-B12D4182
//Variables @51-D6FF3E86
// Public variables
var $ComponentType = "Record";
var $ComponentName;
var $Parent;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormEnctype;
var $Visible;
var $IsEmpty;
var $CCSEvents = "";
var $CCSEventResult;
var $RelativePath = "";
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $EditMode = false;
var $ds;
var $DataSource;
var $ValidatingControls;
var $Controls;
var $Attributes;
// Class variables
//End Variables
//Class_Initialize Event @51-31726A62
function clsRecordcashtran1($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record cashtran1/Error";
$this->DataSource = new clscashtran1DataSource($this);
$this->ds = & $this->DataSource;
$this->ReadAllowed = true;
$this->Visible = (CCSecurityAccessCheck("1;2;3") == "success");
if($this->Visible)
{
$this->ReadAllowed = $this->ReadAllowed && CCUserInGroups(CCGetGroupID(), "1;2;3");
$this->UpdateAllowed = CCUserInGroups(CCGetGroupID(), "1;3");
$this->DeleteAllowed = CCUserInGroups(CCGetGroupID(), "2;3");
$this->ComponentName = "cashtran1";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->EditMode = ($FormMethod == "Edit");
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($FormName == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->RefNbr = & new clsControl(ccsTextBox, "RefNbr", "Ref Nbr", ccsText, "", CCGetRequestParam("RefNbr", $Method, NULL), $this);
$this->module = & new clsControl(ccsHidden, "module", "module", ccsText, "", CCGetRequestParam("module", $Method, NULL), $this);
$this->ChqNbr = & new clsControl(ccsTextBox, "ChqNbr", "Chq Nbr", ccsText, "", CCGetRequestParam("ChqNbr", $Method, NULL), $this);
$this->screen = & new clsControl(ccsHidden, "screen", "screen", ccsText, "", CCGetRequestParam("screen", $Method, NULL), $this);
$this->Acct = & new clsControl(ccsListBox, "Acct", "Acct", ccsText, "", CCGetRequestParam("Acct", $Method, NULL), $this);
$this->Acct->DSType = dsProcedure;
$this->Acct->DataSource = new clsDBCoopWorksConn();
$this->Acct->ds = & $this->Acct->DataSource;
list($this->Acct->BoundColumn, $this->Acct->TextColumn, $this->Acct->DBFormat) = array("acct", "description", "");
$this->Acct->DataSource->SQL = "CALL SM_AllAcctList (" . ");";
$this->user = & new clsControl(ccsHidden, "user", "user", ccsText, "", CCGetRequestParam("user", $Method, NULL), $this);
$this->Sub = & new clsControl(ccsListBox, "Sub", "Sub", ccsText, "", CCGetRequestParam("Sub", $Method, NULL), $this);
$this->Sub->DSType = dsProcedure;
$this->Sub->DataSource = new clsDBCoopWorksConn();
$this->Sub->ds = & $this->Sub->DataSource;
list($this->Sub->BoundColumn, $this->Sub->TextColumn, $this->Sub->DBFormat) = array("Sub", "description", "");
$this->Sub->DataSource->SQL = "CALL SM_SubAcctList (" . ");";
$this->timed = & new clsControl(ccsHidden, "timed", "timed", ccsDate, array("mm", "/", "dd", "/", "yyyy", " ", "h", ":", "nn", " ", "AM/PM"), CCGetRequestParam("timed", $Method, NULL), $this);
$this->TranDate = & new clsControl(ccsTextBox, "TranDate", "Tran Date", ccsDate, $DefaultDateFormat, CCGetRequestParam("TranDate", $Method, NULL), $this);
$this->TranDesc = & new clsControl(ccsTextBox, "TranDesc", "Tran Desc", ccsText, "", CCGetRequestParam("TranDesc", $Method, NULL), $this);
$this->TranAmt = & new clsControl(ccsTextBox, "TranAmt", "Tran Amt", ccsFloat, "", CCGetRequestParam("TranAmt", $Method, NULL), $this);
$this->Button_Update = & new clsButton("Button_Update", $Method, $this);
$this->Button_Delete = & new clsButton("Button_Delete", $Method, $this);
$this->Button_Cancel = & new clsButton("Button_Cancel", $Method, $this);
if(!$this->FormSubmitted) {
if(!is_array($this->module->Value) && !strlen($this->module->Value) && $this->module->Value !== false)
$this->module->SetText($_SESSION['slModuleName1']);
if(!is_array($this->screen->Value) && !strlen($this->screen->Value) && $this->screen->Value !== false)
$this->screen->SetText($_SESSION['slScreen']);
if(!is_array($this->user->Value) && !strlen($this->user->Value) && $this->user->Value !== false)
$this->user->SetText(CCGetSession("UserID"));
if(!is_array($this->timed->Value) && !strlen($this->timed->Value) && $this->timed->Value !== false)
$this->timed->SetValue(time());
}
}
}
//End Class_Initialize Event
//Initialize Method @51-219EE253
function Initialize()
{
if(!$this->Visible)
return;
$this->DataSource->Parameters["urlRecId"] = CCGetFromGet("RecId", NULL);
}
//End Initialize Method
//Validate Method @51-05FD04FB
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->RefNbr->Validate() && $Validation);
$Validation = ($this->module->Validate() && $Validation);
$Validation = ($this->ChqNbr->Validate() && $Validation);
$Validation = ($this->screen->Validate() && $Validation);
$Validation = ($this->Acct->Validate() && $Validation);
$Validation = ($this->user->Validate() && $Validation);
$Validation = ($this->Sub->Validate() && $Validation);
$Validation = ($this->timed->Validate() && $Validation);
$Validation = ($this->TranDate->Validate() && $Validation);
$Validation = ($this->TranDesc->Validate() && $Validation);
$Validation = ($this->TranAmt->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
$Validation = $Validation && ($this->RefNbr->Errors->Count() == 0);
$Validation = $Validation && ($this->module->Errors->Count() == 0);
$Validation = $Validation && ($this->ChqNbr->Errors->Count() == 0);
$Validation = $Validation && ($this->screen->Errors->Count() == 0);
$Validation = $Validation && ($this->Acct->Errors->Count() == 0);
$Validation = $Validation && ($this->user->Errors->Count() == 0);
$Validation = $Validation && ($this->Sub->Errors->Count() == 0);
$Validation = $Validation && ($this->timed->Errors->Count() == 0);
$Validation = $Validation && ($this->TranDate->Errors->Count() == 0);
$Validation = $Validation && ($this->TranDesc->Errors->Count() == 0);
$Validation = $Validation && ($this->TranAmt->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @51-59CD0E8E
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->RefNbr->Errors->Count());
$errors = ($errors || $this->module->Errors->Count());
$errors = ($errors || $this->ChqNbr->Errors->Count());
$errors = ($errors || $this->screen->Errors->Count());
$errors = ($errors || $this->Acct->Errors->Count());
$errors = ($errors || $this->user->Errors->Count());
$errors = ($errors || $this->Sub->Errors->Count());
$errors = ($errors || $this->timed->Errors->Count());
$errors = ($errors || $this->TranDate->Errors->Count());
$errors = ($errors || $this->TranDesc->Errors->Count());
$errors = ($errors || $this->TranAmt->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->DataSource->Errors->Count());
return $errors;
}
//End CheckErrors Method
//MasterDetail @51-ED598703
function SetPrimaryKeys($keyArray)
{
$this->PrimaryKeys = $keyArray;
}
function GetPrimaryKeys()
{
return $this->PrimaryKeys;
}
function GetPrimaryKey($keyName)
{
return $this->PrimaryKeys[$keyName];
}
//End MasterDetail
//Operation Method @51-20A98532
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->DataSource->Prepare();
if(!$this->FormSubmitted) {
$this->EditMode = $this->DataSource->AllParametersSet;
return;
}
if($this->FormSubmitted) {
$this->PressedButton = $this->EditMode ? "Button_Update" : "Button_Cancel";
if($this->Button_Update->Pressed) {
$this->PressedButton = "Button_Update";
} else if($this->Button_Delete->Pressed) {
$this->PressedButton = "Button_Delete";
} else if($this->Button_Cancel->Pressed) {
$this->PressedButton = "Button_Cancel";
}
}
$Redirect = $FileName . "?" . CCGetQueryString("QueryString", array("ccsForm"));
if($this->PressedButton == "Button_Delete" && $this->DeleteAllowed) {
if(!CCGetEvent($this->Button_Delete->CCSEvents, "OnClick", $this->Button_Delete) || !$this->DeleteRow()) {
$Redirect = "";
}
} else if($this->PressedButton == "Button_Cancel") {
$Redirect = $FileName . "?" . CCGetQueryString("QueryString", array("ccsForm", "RefNbr"));
if(!CCGetEvent($this->Button_Cancel->CCSEvents, "OnClick", $this->Button_Cancel)) {
$Redirect = "";
}
} else if($this->Validate()) {
if($this->PressedButton == "Button_Update" && $this->UpdateAllowed) {
if(!CCGetEvent($this->Button_Update->CCSEvents, "OnClick", $this->Button_Update) || !$this->UpdateRow()) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
if ($Redirect)
$this->DataSource->close();
}
//End Operation Method
//UpdateRow Method @51-56C89FAB
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this);
if(!$this->UpdateAllowed) return false;
$this->DataSource->RefNbr->SetValue($this->RefNbr->GetValue(true));
$this->DataSource->TranDate->SetValue($this->TranDate->GetValue(true));
$this->DataSource->TranDesc->SetValue($this->TranDesc->GetValue(true));
$this->DataSource->TranAmt->SetValue($this->TranAmt->GetValue(true));
$this->DataSource->Acct->SetValue($this->Acct->GetValue(true));
$this->DataSource->Sub->SetValue($this->Sub->GetValue(true));
$this->DataSource->ChqNbr->SetValue($this->ChqNbr->GetValue(true));
$this->DataSource->module->SetValue($this->module->GetValue(true));
$this->DataSource->screen->SetValue($this->screen->GetValue(true));
$this->DataSource->user->SetValue($this->user->GetValue(true));
$this->DataSource->timed->SetValue($this->timed->GetValue(true));
$this->DataSource->Update();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterUpdate", $this);
return (!$this->CheckErrors());
}
//End UpdateRow Method
//DeleteRow Method @51-299D98C3
function DeleteRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeDelete", $this);
if(!$this->DeleteAllowed) return false;
$this->DataSource->Delete();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterDelete", $this);
return (!$this->CheckErrors());
}
//End DeleteRow Method
//Show Method @51-61F60180
function Show()
{
global $CCSUseAmp;
global $Tpl;
global $FileName;
global $CCSLocales;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->Acct->Prepare();
$this->Sub->Prepare();
$RecordBlock = "Record " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $RecordBlock;
$this->EditMode = $this->EditMode && $this->ReadAllowed;
if($this->EditMode) {
if($this->DataSource->Errors->Count()){
$this->Errors->AddErrors($this->DataSource->Errors);
$this->DataSource->Errors->clear();
}
$this->DataSource->Open();
if($this->DataSource->Errors->Count() == 0 && $this->DataSource->next_record()) {
$this->DataSource->SetValues();
if(!$this->FormSubmitted){
$this->RefNbr->SetValue($this->DataSource->RefNbr->GetValue());
$this->ChqNbr->SetValue($this->DataSource->ChqNbr->GetValue());
$this->Acct->SetValue($this->DataSource->Acct->GetValue());
$this->Sub->SetValue($this->DataSource->Sub->GetValue());
$this->TranDate->SetValue($this->DataSource->TranDate->GetValue());
$this->TranDesc->SetValue($this->DataSource->TranDesc->GetValue());
$this->TranAmt->SetValue($this->DataSource->TranAmt->GetValue());
}
} else {
$this->EditMode = false;
}
}
if (!$this->FormSubmitted) {
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error = "";
$Error = ComposeStrings($Error, $this->RefNbr->Errors->ToString());
$Error = ComposeStrings($Error, $this->module->Errors->ToString());
$Error = ComposeStrings($Error, $this->ChqNbr->Errors->ToString());
$Error = ComposeStrings($Error, $this->screen->Errors->ToString());
$Error = ComposeStrings($Error, $this->Acct->Errors->ToString());
$Error = ComposeStrings($Error, $this->user->Errors->ToString());
$Error = ComposeStrings($Error, $this->Sub->Errors->ToString());
$Error = ComposeStrings($Error, $this->timed->Errors->ToString());
$Error = ComposeStrings($Error, $this->TranDate->Errors->ToString());
$Error = ComposeStrings($Error, $this->TranDesc->Errors->ToString());
$Error = ComposeStrings($Error, $this->TranAmt->Errors->ToString());
$Error = ComposeStrings($Error, $this->Errors->ToString());
$Error = ComposeStrings($Error, $this->DataSource->Errors->ToString());
$Tpl->SetVar("Error", $Error);
$Tpl->Parse("Error", false);
}
$CCSForm = $this->EditMode ? $this->ComponentName . ":" . "Edit" : $this->ComponentName;
$this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $CCSForm);
$Tpl->SetVar("Action", !$CCSUseAmp ? $this->HTMLFormAction : str_replace("&", "&", $this->HTMLFormAction));
$Tpl->SetVar("HTMLFormName", $this->ComponentName);
$Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
$this->Button_Update->Visible = $this->EditMode && $this->UpdateAllowed;
$this->Button_Delete->Visible = $this->EditMode && $this->DeleteAllowed;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
$this->Attributes->Show();
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$this->RefNbr->Show();
$this->module->Show();
$this->ChqNbr->Show();
$this->screen->Show();
$this->Acct->Show();
$this->user->Show();
$this->Sub->Show();
$this->timed->Show();
$this->TranDate->Show();
$this->TranDesc->Show();
$this->TranAmt->Show();
$this->Button_Update->Show();
$this->Button_Delete->Show();
$this->Button_Cancel->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
} //End cashtran1 Class @51-FCB6E20C
class clscashtran1DataSource extends clsDBCoopWorksConn { //cashtran1DataSource Class @51-DEEEE45A
//DataSource Variables @51-1341B679
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $RefNbr;
var $module;
var $ChqNbr;
var $screen;
var $Acct;
var $user;
var $Sub;
var $timed;
var $TranDate;
var $TranDesc;
var $TranAmt;
//End DataSource Variables
//DataSourceClass_Initialize Event @51-E85BDD37
function clscashtran1DataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Record cashtran1/Error";
$this->Initialize();
$this->RefNbr = new clsField("RefNbr", ccsText, "");
$this->module = new clsField("module", ccsText, "");
$this->ChqNbr = new clsField("ChqNbr", ccsText, "");
$this->screen = new clsField("screen", ccsText, "");
$this->Acct = new clsField("Acct", ccsText, "");
$this->user = new clsField("user", ccsText, "");
$this->Sub = new clsField("Sub", ccsText, "");
$this->timed = new clsField("timed", ccsDate, $this->DateFormat);
$this->TranDate = new clsField("TranDate", ccsDate, $this->DateFormat);
$this->TranDesc = new clsField("TranDesc", ccsText, "");
$this->TranAmt = new clsField("TranAmt", ccsFloat, "");
}
//End DataSourceClass_Initialize Event
//Prepare Method @51-F1003328
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlRecId", ccsInteger, "", "", $this->Parameters["urlRecId"], "", false);
$this->AllParametersSet = $this->wp->AllParamsSet();
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "RecId", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
$this->Where =
$this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @51-287832F3
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->SQL = "SELECT * \n\n" .
"FROM cashtran {SQL_Where} {SQL_OrderBy}";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
$this->PageSize = 1;
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
}
//End Open Method
//SetValues Method @51-52AC7D94
function SetValues()
{
$this->RefNbr->SetDBValue($this->f("RefNbr"));
$this->ChqNbr->SetDBValue($this->f("ChqNbr"));
$this->Acct->SetDBValue($this->f("Acct"));
$this->Sub->SetDBValue($this->f("Sub"));
$this->TranDate->SetDBValue(trim($this->f("TranDate")));
$this->TranDesc->SetDBValue($this->f("TranDesc"));
$this->TranAmt->SetDBValue(trim($this->f("TranAmt")));
}
//End SetValues Method
//Update Method @51-4F109AD9
function Update()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->cp["xRefNbr"] = new clsSQLParameter("ctrlRefNbr", ccsText, "", "", $this->RefNbr->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xtrandate"] = new clsSQLParameter("ctrlTranDate", ccsDate, $DefaultDateFormat, $this->DateFormat, $this->TranDate->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xtrandesc"] = new clsSQLParameter("ctrlTranDesc", ccsText, "", "", $this->TranDesc->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xtranamt"] = new clsSQLParameter("ctrlTranAmt", ccsFloat, "", "", $this->TranAmt->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xacct"] = new clsSQLParameter("ctrlAcct", ccsText, "", "", $this->Acct->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xsub"] = new clsSQLParameter("ctrlSub", ccsText, "", "", $this->Sub->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xchkNbr"] = new clsSQLParameter("ctrlChqNbr", ccsText, "", "", $this->ChqNbr->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xRecId"] = new clsSQLParameter("urlRecId", ccsInteger, "", "", CCGetFromGet("RecId", NULL), "", false, $this->ErrorBlock);
$this->cp["xmodule"] = new clsSQLParameter("ctrlmodule", ccsText, "", "", $this->module->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xscreen"] = new clsSQLParameter("ctrlscreen", ccsText, "", "", $this->screen->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xusername"] = new clsSQLParameter("ctrluser", ccsText, "", "", $this->user->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xtimed"] = new clsSQLParameter("ctrltimed", ccsDate, array("mm", "/", "dd", "/", "yyyy", " ", "h", ":", "nn", " ", "AM/PM"), $this->DateFormat, $this->timed->GetValue(true), "", false, $this->ErrorBlock);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent);
if (!is_null($this->cp["xRefNbr"]->GetValue()) and !strlen($this->cp["xRefNbr"]->GetText()) and !is_bool($this->cp["xRefNbr"]->GetValue()))
$this->cp["xRefNbr"]->SetValue($this->RefNbr->GetValue(true));
if (!is_null($this->cp["xtrandate"]->GetValue()) and !strlen($this->cp["xtrandate"]->GetText()) and !is_bool($this->cp["xtrandate"]->GetValue()))
$this->cp["xtrandate"]->SetValue($this->TranDate->GetValue(true));
if (!is_null($this->cp["xtrandesc"]->GetValue()) and !strlen($this->cp["xtrandesc"]->GetText()) and !is_bool($this->cp["xtrandesc"]->GetValue()))
$this->cp["xtrandesc"]->SetValue($this->TranDesc->GetValue(true));
if (!is_null($this->cp["xtranamt"]->GetValue()) and !strlen($this->cp["xtranamt"]->GetText()) and !is_bool($this->cp["xtranamt"]->GetValue()))
$this->cp["xtranamt"]->SetValue($this->TranAmt->GetValue(true));
if (!is_null($this->cp["xacct"]->GetValue()) and !strlen($this->cp["xacct"]->GetText()) and !is_bool($this->cp["xacct"]->GetValue()))
$this->cp["xacct"]->SetValue($this->Acct->GetValue(true));
if (!is_null($this->cp["xsub"]->GetValue()) and !strlen($this->cp["xsub"]->GetText()) and !is_bool($this->cp["xsub"]->GetValue()))
$this->cp["xsub"]->SetValue($this->Sub->GetValue(true));
if (!is_null($this->cp["xchkNbr"]->GetValue()) and !strlen($this->cp["xchkNbr"]->GetText()) and !is_bool($this->cp["xchkNbr"]->GetValue()))
$this->cp["xchkNbr"]->SetValue($this->ChqNbr->GetValue(true));
if (!is_null($this->cp["xRecId"]->GetValue()) and !strlen($this->cp["xRecId"]->GetText()) and !is_bool($this->cp["xRecId"]->GetValue()))
$this->cp["xRecId"]->SetText(CCGetFromGet("RecId", NULL));
if (!is_null($this->cp["xmodule"]->GetValue()) and !strlen($this->cp["xmodule"]->GetText()) and !is_bool($this->cp["xmodule"]->GetValue()))
$this->cp["xmodule"]->SetValue($this->module->GetValue(true));
if (!is_null($this->cp["xscreen"]->GetValue()) and !strlen($this->cp["xscreen"]->GetText()) and !is_bool($this->cp["xscreen"]->GetValue()))
$this->cp["xscreen"]->SetValue($this->screen->GetValue(true));
if (!is_null($this->cp["xusername"]->GetValue()) and !strlen($this->cp["xusername"]->GetText()) and !is_bool($this->cp["xusername"]->GetValue()))
$this->cp["xusername"]->SetValue($this->user->GetValue(true));
if (!is_null($this->cp["xtimed"]->GetValue()) and !strlen($this->cp["xtimed"]->GetText()) and !is_bool($this->cp["xtimed"]->GetValue()))
$this->cp["xtimed"]->SetValue($this->timed->GetValue(true));
$this->SQL = "CALL CA_PaymentVoucher_Update (" . $this->ToSQL($this->cp["xRefNbr"]->GetDBValue(), $this->cp["xRefNbr"]->DataType) . ", "
. $this->ToSQL($this->cp["xtrandate"]->GetDBValue(), $this->cp["xtrandate"]->DataType) . ", "
. $this->ToSQL($this->cp["xtrandesc"]->GetDBValue(), $this->cp["xtrandesc"]->DataType) . ", "
. $this->ToSQL($this->cp["xtranamt"]->GetDBValue(), $this->cp["xtranamt"]->DataType) . ", "
. $this->ToSQL($this->cp["xacct"]->GetDBValue(), $this->cp["xacct"]->DataType) . ", "
. $this->ToSQL($this->cp["xsub"]->GetDBValue(), $this->cp["xsub"]->DataType) . ", "
. $this->ToSQL($this->cp["xchkNbr"]->GetDBValue(), $this->cp["xchkNbr"]->DataType) . ", "
. $this->ToSQL($this->cp["xRecId"]->GetDBValue(), $this->cp["xRecId"]->DataType) . ", "
. $this->ToSQL($this->cp["xmodule"]->GetDBValue(), $this->cp["xmodule"]->DataType) . ", "
. $this->ToSQL($this->cp["xscreen"]->GetDBValue(), $this->cp["xscreen"]->DataType) . ", "
. $this->ToSQL($this->cp["xusername"]->GetDBValue(), $this->cp["xusername"]->DataType) . ", "
. $this->ToSQL($this->cp["xtimed"]->GetDBValue(), $this->cp["xtimed"]->DataType) . ");";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate", $this->Parent);
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate", $this->Parent);
}
}
//End Update Method
//Delete Method @51-798E40DF
function Delete()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->cp["xRecId"] = new clsSQLParameter("urlRecId", ccsInteger, "", "", CCGetFromGet("RecId", NULL), "", false, $this->ErrorBlock);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete", $this->Parent);
if (!is_null($this->cp["xRecId"]->GetValue()) and !strlen($this->cp["xRecId"]->GetText()) and !is_bool($this->cp["xRecId"]->GetValue()))
$this->cp["xRecId"]->SetText(CCGetFromGet("RecId", NULL));
$this->SQL = "CALL CA_PaymentVoucher_Delete (" . $this->ToSQL($this->cp["xRecId"]->GetDBValue(), $this->cp["xRecId"]->DataType) . ");";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteDelete", $this->Parent);
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteDelete", $this->Parent);
}
}
//End Delete Method
} //End cashtran1DataSource Class @51-FCB6E20C
//Initialize Page @1-DD69F990
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
$Attributes = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "CA_PaymentVoucher_Edit.html";
$BlockToParse = "main";
$TemplateEncoding = "UTF-8";
$ContentType = "text/html";
$PathToRoot = "./";
$Charset = $Charset ? $Charset : "utf-8";
//End Initialize Page
//Authenticate User @1-946ECC7A
CCSecurityRedirect("1;2;3", "");
//End Authenticate User
//Before Initialize @1-E870CEBC
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage);
//End Before Initialize
//Initialize Objects @1-0FDA0EB9
$DBCoopWorksConn = new clsDBCoopWorksConn();
$MainPage->Connections["CoopWorksConn"] = & $DBCoopWorksConn;
$Attributes = new clsAttributes("page:");
$MainPage->Attributes = & $Attributes;
// Controls
$cashtranSearch = & new clsRecordcashtranSearch("", $MainPage);
$cashtran = & new clsGridcashtran("", $MainPage);
$cashtran1 = & new clsRecordcashtran1("", $MainPage);
$MainPage->cashtranSearch = & $cashtranSearch;
$MainPage->cashtran = & $cashtran;
$MainPage->cashtran1 = & $cashtran1;
$cashtran->Initialize();
$cashtran1->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
if ($Charset) {
header("Content-Type: " . $ContentType . "; charset=" . $Charset);
} else {
header("Content-Type: " . $ContentType);
}
//End Initialize Objects
//Initialize HTML Template @1-A06E9207
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
$Tpl = new clsTemplate($FileEncoding, $TemplateEncoding);
$Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "UTF-8", "replace");
$Tpl->block_path = "/$BlockToParse";
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
$Attributes->SetValue("pathToRoot", "");
$Attributes->Show();
//End Initialize HTML Template
//Execute Components @1-9561A7D2
$cashtranSearch->Operation();
$cashtran1->Operation();
//End Execute Components
//Go to destination page @1-99A302B8
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBCoopWorksConn->close();
header("Location: " . $Redirect);
unset($cashtranSearch);
unset($cashtran);
unset($cashtran1);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-537890C7
$cashtranSearch->Show();
$cashtran->Show();
$cashtran1->Show();
$Tpl->block_path = "";
$Tpl->Parse($BlockToParse, false);
if (!isset($main_block)) $main_block = $Tpl->GetVar($BlockToParse);
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage);
if ($CCSEventResult) echo $main_block;
//End Show Page
//Unload Page @1-E9FF3C7B
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBCoopWorksConn->close();
unset($cashtranSearch);
unset($cashtran);
unset($cashtran1);
unset($Tpl);
//End Unload Page
?>