<?php
//Include Common Files @1-228B6D3C
define("RelativePath", ".");
define("PathToCurrentPage", "/");
define("FileName", "PR_Emp_Deduction_Entry.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 clsRecordempdeduction1 { //empdeduction1 Class @22-7F5F53AC
//Variables @22-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 @22-E78CDE7D
function clsRecordempdeduction1($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record empdeduction1/Error";
$this->DataSource = new clsempdeduction1DataSource($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->InsertAllowed = CCUserInGroups(CCGetGroupID(), "1;3");
$this->UpdateAllowed = CCUserInGroups(CCGetGroupID(), "1;3");
$this->DeleteAllowed = CCUserInGroups(CCGetGroupID(), "2;3");
$this->ComponentName = "empdeduction1";
$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->EmpID = & new clsControl(ccsListBox, "EmpID", "Emp ID", ccsText, "", CCGetRequestParam("EmpID", $Method, NULL), $this);
$this->EmpID->DSType = dsProcedure;
$this->EmpID->DataSource = new clsDBCoopWorksConn();
$this->EmpID->ds = & $this->EmpID->DataSource;
list($this->EmpID->BoundColumn, $this->EmpID->TextColumn, $this->EmpID->DBFormat) = array("empid", "Name", "");
$this->EmpID->DataSource->SQL = "CALL Sm_employee_List (" . ");";
$this->EmpID->Required = true;
$this->module = & new clsControl(ccsHidden, "module", "module", ccsText, "", CCGetRequestParam("module", $Method, NULL), $this);
$this->DedID = & new clsControl(ccsListBox, "DedID", "Ded ID", ccsText, "", CCGetRequestParam("DedID", $Method, NULL), $this);
$this->DedID->DSType = dsTable;
$this->DedID->DataSource = new clsDBCoopWorksConn();
$this->DedID->ds = & $this->DedID->DataSource;
$this->DedID->DataSource->SQL = "SELECT * \n" .
"FROM deduction {SQL_Where} {SQL_OrderBy}";
list($this->DedID->BoundColumn, $this->DedID->TextColumn, $this->DedID->DBFormat) = array("DedId", "Descr", "");
$this->DedID->Required = true;
$this->timed = & new clsControl(ccsHidden, "timed", "timed", ccsDate, array("mm", "/", "dd", "/", "yyyy", " ", "h", ":", "nn", " ", "AM/PM"), CCGetRequestParam("timed", $Method, NULL), $this);
$this->Perpetual = & new clsControl(ccsCheckBox, "Perpetual", "Perpetual", ccsInteger, "", CCGetRequestParam("Perpetual", $Method, NULL), $this);
$this->Perpetual->CheckedValue = $this->Perpetual->GetParsedValue(1);
$this->Perpetual->UncheckedValue = $this->Perpetual->GetParsedValue(0);
$this->screen = & new clsControl(ccsHidden, "screen", "screen", ccsText, "", CCGetRequestParam("screen", $Method, NULL), $this);
$this->Rate = & new clsControl(ccsTextBox, "Rate", "Rate", ccsFloat, "", CCGetRequestParam("Rate", $Method, NULL), $this);
$this->Rate->Required = true;
$this->user = & new clsControl(ccsHidden, "user", "user", ccsText, "", CCGetRequestParam("user", $Method, NULL), $this);
$this->Button_Insert = & new clsButton("Button_Insert", $Method, $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->timed->Value) && !strlen($this->timed->Value) && $this->timed->Value !== false)
$this->timed->SetValue(time());
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"));
}
}
}
//End Class_Initialize Event
//Initialize Method @22-1B72D680
function Initialize()
{
if(!$this->Visible)
return;
$this->DataSource->Parameters["urlrecid"] = CCGetFromGet("recid", NULL);
}
//End Initialize Method
//Validate Method @22-4C4217CD
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->EmpID->Validate() && $Validation);
$Validation = ($this->module->Validate() && $Validation);
$Validation = ($this->DedID->Validate() && $Validation);
$Validation = ($this->timed->Validate() && $Validation);
$Validation = ($this->Perpetual->Validate() && $Validation);
$Validation = ($this->screen->Validate() && $Validation);
$Validation = ($this->Rate->Validate() && $Validation);
$Validation = ($this->user->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
$Validation = $Validation && ($this->EmpID->Errors->Count() == 0);
$Validation = $Validation && ($this->module->Errors->Count() == 0);
$Validation = $Validation && ($this->DedID->Errors->Count() == 0);
$Validation = $Validation && ($this->timed->Errors->Count() == 0);
$Validation = $Validation && ($this->Perpetual->Errors->Count() == 0);
$Validation = $Validation && ($this->screen->Errors->Count() == 0);
$Validation = $Validation && ($this->Rate->Errors->Count() == 0);
$Validation = $Validation && ($this->user->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @22-C67D2DC7
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->EmpID->Errors->Count());
$errors = ($errors || $this->module->Errors->Count());
$errors = ($errors || $this->DedID->Errors->Count());
$errors = ($errors || $this->timed->Errors->Count());
$errors = ($errors || $this->Perpetual->Errors->Count());
$errors = ($errors || $this->screen->Errors->Count());
$errors = ($errors || $this->Rate->Errors->Count());
$errors = ($errors || $this->user->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->DataSource->Errors->Count());
return $errors;
}
//End CheckErrors Method
//MasterDetail @22-ED598703
function SetPrimaryKeys($keyArray)
{
$this->PrimaryKeys = $keyArray;
}
function GetPrimaryKeys()
{
return $this->PrimaryKeys;
}
function GetPrimaryKey($keyName)
{
return $this->PrimaryKeys[$keyName];
}
//End MasterDetail
//Operation Method @22-EAE11D17
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_Insert";
if($this->Button_Insert->Pressed) {
$this->PressedButton = "Button_Insert";
} else 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", "recid"));
if(!CCGetEvent($this->Button_Cancel->CCSEvents, "OnClick", $this->Button_Cancel)) {
$Redirect = "";
}
} else if($this->Validate()) {
if($this->PressedButton == "Button_Insert" && $this->InsertAllowed) {
if(!CCGetEvent($this->Button_Insert->CCSEvents, "OnClick", $this->Button_Insert) || !$this->InsertRow()) {
$Redirect = "";
}
} else 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
//InsertRow Method @22-8B827CB2
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this);
if(!$this->InsertAllowed) return false;
$this->DataSource->EmpID->SetValue($this->EmpID->GetValue(true));
$this->DataSource->DedID->SetValue($this->DedID->GetValue(true));
$this->DataSource->DedID->SetValue($this->DedID->GetValue(true));
$this->DataSource->Rate->SetValue($this->Rate->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->Insert();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert", $this);
return (!$this->CheckErrors());
}
//End InsertRow Method
//UpdateRow Method @22-85A22A82
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this);
if(!$this->UpdateAllowed) return false;
$this->DataSource->EmpID->SetValue($this->EmpID->GetValue(true));
$this->DataSource->DedID->SetValue($this->DedID->GetValue(true));
$this->DataSource->Perpetual->SetValue($this->Perpetual->GetValue(true));
$this->DataSource->Rate->SetValue($this->Rate->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 @22-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 @22-55432707
function Show()
{
global $CCSUseAmp;
global $Tpl;
global $FileName;
global $CCSLocales;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->EmpID->Prepare();
$this->DedID->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->EmpID->SetValue($this->DataSource->EmpID->GetValue());
$this->DedID->SetValue($this->DataSource->DedID->GetValue());
$this->Perpetual->SetValue($this->DataSource->Perpetual->GetValue());
$this->Rate->SetValue($this->DataSource->Rate->GetValue());
}
} else {
$this->EditMode = false;
}
}
if (!$this->FormSubmitted) {
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error = "";
$Error = ComposeStrings($Error, $this->EmpID->Errors->ToString());
$Error = ComposeStrings($Error, $this->module->Errors->ToString());
$Error = ComposeStrings($Error, $this->DedID->Errors->ToString());
$Error = ComposeStrings($Error, $this->timed->Errors->ToString());
$Error = ComposeStrings($Error, $this->Perpetual->Errors->ToString());
$Error = ComposeStrings($Error, $this->screen->Errors->ToString());
$Error = ComposeStrings($Error, $this->Rate->Errors->ToString());
$Error = ComposeStrings($Error, $this->user->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_Insert->Visible = !$this->EditMode && $this->InsertAllowed;
$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->EmpID->Show();
$this->module->Show();
$this->DedID->Show();
$this->timed->Show();
$this->Perpetual->Show();
$this->screen->Show();
$this->Rate->Show();
$this->user->Show();
$this->Button_Insert->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 empdeduction1 Class @22-FCB6E20C
class clsempdeduction1DataSource extends clsDBCoopWorksConn { //empdeduction1DataSource Class @22-E3B5682C
//DataSource Variables @22-06C1BC77
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $EmpID;
var $module;
var $DedID;
var $timed;
var $Perpetual;
var $screen;
var $Rate;
var $user;
//End DataSource Variables
//DataSourceClass_Initialize Event @22-495F906B
function clsempdeduction1DataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Record empdeduction1/Error";
$this->Initialize();
$this->EmpID = new clsField("EmpID", ccsText, "");
$this->module = new clsField("module", ccsText, "");
$this->DedID = new clsField("DedID", ccsText, "");
$this->timed = new clsField("timed", ccsDate, $this->DateFormat);
$this->Perpetual = new clsField("Perpetual", ccsInteger, "");
$this->screen = new clsField("screen", ccsText, "");
$this->Rate = new clsField("Rate", ccsFloat, "");
$this->user = new clsField("user", ccsText, "");
}
//End DataSourceClass_Initialize Event
//Prepare Method @22-D00DC739
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 @22-C31BAA8F
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->SQL = "SELECT * \n\n" .
"FROM empdeduction {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 @22-15DC9EB3
function SetValues()
{
$this->EmpID->SetDBValue($this->f("EmpID"));
$this->DedID->SetDBValue($this->f("DedID"));
$this->Perpetual->SetDBValue(trim($this->f("Perpetual")));
$this->Rate->SetDBValue(trim($this->f("Rate")));
}
//End SetValues Method
//Insert Method @22-51775942
function Insert()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->cp["xempid"] = new clsSQLParameter("ctrlEmpID", ccsText, "", "", $this->EmpID->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xdedid"] = new clsSQLParameter("ctrlDedID", ccsText, "", "", $this->DedID->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xperpetual"] = new clsSQLParameter("ctrlDedID", ccsInteger, "", "", $this->DedID->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xrate"] = new clsSQLParameter("ctrlRate", ccsFloat, "", "", $this->Rate->GetValue(true), "", 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["xuser"] = 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, "BeforeBuildInsert", $this->Parent);
if (!is_null($this->cp["xempid"]->GetValue()) and !strlen($this->cp["xempid"]->GetText()) and !is_bool($this->cp["xempid"]->GetValue()))
$this->cp["xempid"]->SetValue($this->EmpID->GetValue(true));
if (!is_null($this->cp["xdedid"]->GetValue()) and !strlen($this->cp["xdedid"]->GetText()) and !is_bool($this->cp["xdedid"]->GetValue()))
$this->cp["xdedid"]->SetValue($this->DedID->GetValue(true));
if (!is_null($this->cp["xperpetual"]->GetValue()) and !strlen($this->cp["xperpetual"]->GetText()) and !is_bool($this->cp["xperpetual"]->GetValue()))
$this->cp["xperpetual"]->SetValue($this->DedID->GetValue(true));
if (!is_null($this->cp["xrate"]->GetValue()) and !strlen($this->cp["xrate"]->GetText()) and !is_bool($this->cp["xrate"]->GetValue()))
$this->cp["xrate"]->SetValue($this->Rate->GetValue(true));
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["xuser"]->GetValue()) and !strlen($this->cp["xuser"]->GetText()) and !is_bool($this->cp["xuser"]->GetValue()))
$this->cp["xuser"]->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 PR_Emp_deduction_Insert (" . $this->ToSQL($this->cp["xempid"]->GetDBValue(), $this->cp["xempid"]->DataType) . ", "
. $this->ToSQL($this->cp["xdedid"]->GetDBValue(), $this->cp["xdedid"]->DataType) . ", "
. $this->ToSQL($this->cp["xperpetual"]->GetDBValue(), $this->cp["xperpetual"]->DataType) . ", "
. $this->ToSQL($this->cp["xrate"]->GetDBValue(), $this->cp["xrate"]->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["xuser"]->GetDBValue(), $this->cp["xuser"]->DataType) . ", "
. $this->ToSQL($this->cp["xtimed"]->GetDBValue(), $this->cp["xtimed"]->DataType) . ");";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert", $this->Parent);
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert", $this->Parent);
}
}
//End Insert Method
//Update Method @22-6C0BE000
function Update()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->cp["xempid"] = new clsSQLParameter("ctrlEmpID", ccsText, "", "", $this->EmpID->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xdedid"] = new clsSQLParameter("ctrlDedID", ccsText, "", "", $this->DedID->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xperpetual"] = new clsSQLParameter("ctrlPerpetual", ccsInteger, "", "", $this->Perpetual->GetValue(true), "", false, $this->ErrorBlock);
$this->cp["xrate"] = new clsSQLParameter("ctrlRate", ccsFloat, "", "", $this->Rate->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["xuser"] = 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["xempid"]->GetValue()) and !strlen($this->cp["xempid"]->GetText()) and !is_bool($this->cp["xempid"]->GetValue()))
$this->cp["xempid"]->SetValue($this->EmpID->GetValue(true));
if (!is_null($this->cp["xdedid"]->GetValue()) and !strlen($this->cp["xdedid"]->GetText()) and !is_bool($this->cp["xdedid"]->GetValue()))
$this->cp["xdedid"]->SetValue($this->DedID->GetValue(true));
if (!is_null($this->cp["xperpetual"]->GetValue()) and !strlen($this->cp["xperpetual"]->GetText()) and !is_bool($this->cp["xperpetual"]->GetValue()))
$this->cp["xperpetual"]->SetValue($this->Perpetual->GetValue(true));
if (!is_null($this->cp["xrate"]->GetValue()) and !strlen($this->cp["xrate"]->GetText()) and !is_bool($this->cp["xrate"]->GetValue()))
$this->cp["xrate"]->SetValue($this->Rate->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["xuser"]->GetValue()) and !strlen($this->cp["xuser"]->GetText()) and !is_bool($this->cp["xuser"]->GetValue()))
$this->cp["xuser"]->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 PR_Emp_deduction_edit (" . $this->ToSQL($this->cp["xempid"]->GetDBValue(), $this->cp["xempid"]->DataType) . ", "
. $this->ToSQL($this->cp["xdedid"]->GetDBValue(), $this->cp["xdedid"]->DataType) . ", "
. $this->ToSQL($this->cp["xperpetual"]->GetDBValue(), $this->cp["xperpetual"]->DataType) . ", "
. $this->ToSQL($this->cp["xrate"]->GetDBValue(), $this->cp["xrate"]->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["xuser"]->GetDBValue(), $this->cp["xuser"]->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 @22-F4D067A7
function Delete()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete", $this->Parent);
$this->SQL = "DELETE FROM empdeduction";
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
if (!strlen($this->Where) && $this->Errors->Count() == 0)
$this->Errors->addError($CCSLocales->GetText("CCS_CustomOperationError_MissingParameters"));
$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 empdeduction1DataSource Class @22-FCB6E20C
class clsGridempdeduction { //empdeduction class @2-C1ECBFD3
//Variables @2-AC1EDBB9
// 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;
//End Variables
//Class_Initialize Event @2-81D0D8DF
function clsGridempdeduction($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->ComponentName = "empdeduction";
$this->Visible = True;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid empdeduction";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$this->DataSource = new clsempdeductionDataSource($this);
$this->ds = & $this->DataSource;
$this->PageSize = CCGetParam($this->ComponentName . "PageSize", "");
if(!is_numeric($this->PageSize) || !strlen($this->PageSize))
$this->PageSize = 100;
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->Detail = & new clsControl(ccsLink, "Detail", "Detail", ccsText, "", CCGetRequestParam("Detail", ccsGet, NULL), $this);
$this->Detail->Page = "PR_Emp_Deduction_Entry.php";
$this->EmpID = & new clsControl(ccsLabel, "EmpID", "EmpID", ccsText, "", CCGetRequestParam("EmpID", ccsGet, NULL), $this);
$this->Label1 = & new clsControl(ccsLabel, "Label1", "Label1", ccsText, "", CCGetRequestParam("Label1", ccsGet, NULL), $this);
$this->recid = & new clsControl(ccsHidden, "recid", "recid", ccsText, "", CCGetRequestParam("recid", ccsGet, NULL), $this);
$this->DedID = & new clsControl(ccsLabel, "DedID", "DedID", ccsText, "", CCGetRequestParam("DedID", ccsGet, NULL), $this);
$this->Label2 = & new clsControl(ccsLabel, "Label2", "Label2", ccsText, "", CCGetRequestParam("Label2", ccsGet, NULL), $this);
$this->Perpetual = & new clsControl(ccsLabel, "Perpetual", "Perpetual", ccsInteger, "", CCGetRequestParam("Perpetual", ccsGet, NULL), $this);
$this->Rate = & new clsControl(ccsLabel, "Rate", "Rate", ccsFloat, array(False, 2, Null, Null, False, "", "", 1, True, ""), CCGetRequestParam("Rate", ccsGet, NULL), $this);
$this->empdeduction_TotalRecords = & new clsControl(ccsLabel, "empdeduction_TotalRecords", "empdeduction_TotalRecords", ccsText, "", CCGetRequestParam("empdeduction_TotalRecords", ccsGet, NULL), $this);
$this->empdeduction_Insert = & new clsControl(ccsLink, "empdeduction_Insert", "empdeduction_Insert", ccsText, "", CCGetRequestParam("empdeduction_Insert", ccsGet, NULL), $this);
$this->empdeduction_Insert->Parameters = CCGetQueryString("QueryString", array("recid", "ccsForm"));
$this->empdeduction_Insert->Page = "PR_Emp_Deduction_Entry.php";
$this->Navigator = & new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpCentered, $this);
$this->Navigator->PageSizes = array("1", "5", "10", "25", "50");
}
//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-012FF9C3
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$this->RowNumber = 0;
$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["Detail"] = $this->Detail->Visible;
$this->ControlsVisible["EmpID"] = $this->EmpID->Visible;
$this->ControlsVisible["Label1"] = $this->Label1->Visible;
$this->ControlsVisible["recid"] = $this->recid->Visible;
$this->ControlsVisible["DedID"] = $this->DedID->Visible;
$this->ControlsVisible["Label2"] = $this->Label2->Visible;
$this->ControlsVisible["Perpetual"] = $this->Perpetual->Visible;
$this->ControlsVisible["Rate"] = $this->Rate->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->Detail->Parameters = CCGetQueryString("QueryString", array("ccsForm"));
$this->Detail->Parameters = CCAddParam($this->Detail->Parameters, "recid", $this->DataSource->f("recid"));
$this->EmpID->SetValue($this->DataSource->EmpID->GetValue());
$this->Label1->SetValue($this->DataSource->Label1->GetValue());
$this->recid->SetValue($this->DataSource->recid->GetValue());
$this->DedID->SetValue($this->DataSource->DedID->GetValue());
$this->Label2->SetValue($this->DataSource->Label2->GetValue());
$this->Perpetual->SetValue($this->DataSource->Perpetual->GetValue());
$this->Rate->SetValue($this->DataSource->Rate->GetValue());
$this->Attributes->SetValue("rowNumber", $this->RowNumber);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this);
$this->Attributes->Show();
$this->Detail->Show();
$this->EmpID->Show();
$this->Label1->Show();
$this->recid->Show();
$this->DedID->Show();
$this->Label2->Show();
$this->Perpetual->Show();
$this->Rate->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->empdeduction_TotalRecords->Show();
$this->empdeduction_Insert->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
//GetErrors Method @2-EA7B03C2
function GetErrors()
{
$errors = "";
$errors = ComposeStrings($errors, $this->Detail->Errors->ToString());
$errors = ComposeStrings($errors, $this->EmpID->Errors->ToString());
$errors = ComposeStrings($errors, $this->Label1->Errors->ToString());
$errors = ComposeStrings($errors, $this->recid->Errors->ToString());
$errors = ComposeStrings($errors, $this->DedID->Errors->ToString());
$errors = ComposeStrings($errors, $this->Label2->Errors->ToString());
$errors = ComposeStrings($errors, $this->Perpetual->Errors->ToString());
$errors = ComposeStrings($errors, $this->Rate->Errors->ToString());
$errors = ComposeStrings($errors, $this->Errors->ToString());
$errors = ComposeStrings($errors, $this->DataSource->Errors->ToString());
return $errors;
}
//End GetErrors Method
} //End empdeduction Class @2-FCB6E20C
class clsempdeductionDataSource extends clsDBCoopWorksConn { //empdeductionDataSource Class @2-23E0D156
//DataSource Variables @2-25AE400C
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $CountSQL;
var $wp;
// Datasource fields
var $EmpID;
var $Label1;
var $recid;
var $DedID;
var $Label2;
var $Perpetual;
var $Rate;
//End DataSource Variables
//DataSourceClass_Initialize Event @2-986AF8B4
function clsempdeductionDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Grid empdeduction";
$this->Initialize();
$this->EmpID = new clsField("EmpID", ccsText, "");
$this->Label1 = new clsField("Label1", ccsText, "");
$this->recid = new clsField("recid", ccsText, "");
$this->DedID = new clsField("DedID", ccsText, "");
$this->Label2 = new clsField("Label2", ccsText, "");
$this->Perpetual = new clsField("Perpetual", ccsInteger, "");
$this->Rate = new clsField("Rate", ccsFloat, "");
}
//End DataSourceClass_Initialize Event
//SetOrder Method @2-9E1383D1
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
"");
}
//End SetOrder Method
//Prepare Method @2-14D6CD9D
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
}
//End Prepare Method
//Open Method @2-CEEDECCF
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->CountSQL = "SELECT COUNT(*)\n\n" .
"FROM (empdeduction INNER JOIN employee ON\n\n" .
"empdeduction.EmpId = employee.EmpId) INNER JOIN deduction ON\n\n" .
"empdeduction.DedId = deduction.DedId";
$this->SQL = "SELECT recid, empdeduction.EmpID AS empdeduction_EmpID, empdeduction.DedID AS empdeduction_DedID, Perpetual, Rate, employee.*, deduction.* \n\n" .
"FROM (empdeduction INNER JOIN employee ON\n\n" .
"empdeduction.EmpId = employee.EmpId) INNER JOIN deduction ON\n\n" .
"empdeduction.DedId = deduction.DedId {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-0B1B8873
function SetValues()
{
$this->EmpID->SetDBValue($this->f("EmpID"));
$this->Label1->SetDBValue($this->f("Name"));
$this->recid->SetDBValue($this->f("recid"));
$this->DedID->SetDBValue($this->f("DedID"));
$this->Label2->SetDBValue($this->f("Descr"));
$this->Perpetual->SetDBValue(trim($this->f("Perpetual")));
$this->Rate->SetDBValue(trim($this->f("Rate")));
}
//End SetValues Method
} //End empdeductionDataSource Class @2-FCB6E20C
//Initialize Page @1-A18A3F87
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
$Attributes = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "PR_Emp_Deduction_Entry.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
//Include events file @1-A4D3FAED
include_once("./PR_Emp_Deduction_Entry_events.php");
//End Include events file
//Before Initialize @1-E870CEBC
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage);
//End Before Initialize
//Initialize Objects @1-7397C114
$DBCoopWorksConn = new clsDBCoopWorksConn();
$MainPage->Connections["CoopWorksConn"] = & $DBCoopWorksConn;
$Attributes = new clsAttributes("page:");
$MainPage->Attributes = & $Attributes;
// Controls
$empdeduction1 = & new clsRecordempdeduction1("", $MainPage);
$empdeduction = & new clsGridempdeduction("", $MainPage);
$MainPage->empdeduction1 = & $empdeduction1;
$MainPage->empdeduction = & $empdeduction;
$empdeduction1->Initialize();
$empdeduction->Initialize();
BindEvents();
$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-9AD796FC
$empdeduction1->Operation();
//End Execute Components
//Go to destination page @1-5DB3D093
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBCoopWorksConn->close();
header("Location: " . $Redirect);
unset($empdeduction1);
unset($empdeduction);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-C02EA3B3
$empdeduction1->Show();
$empdeduction->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-5D8CF1A9
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBCoopWorksConn->close();
unset($empdeduction1);
unset($empdeduction);
unset($Tpl);
//End Unload Page
?>