/******************************************************************************/
/* FILENAME : ConfirmationFrm.c */
/* Automatically generated by Rrapid Formation 1.0 */
/* Generated on : Thu Apr 03 13:46:05 2003 India Standard Time */
/* ABSTRACT : Code for the form "Confirmation" */
/******************************************************************************/
/* Ideally this file should not be edited. If you edit this */
/* file, a subsequent code generation could overwrite this */
/* file and all changes made will be lost. */
/* If you do modify, make sure you merge your changes to any */
/* susequent code generation. */
/******************************************************************************/
#include "ConfirmationFrm.h"
/******************************************************************************/
/* Event maps map an event to a handler maps or funcions */
BEGIN_EVENT_MAP(ConfirmationEventHandler)
MAP_EVENT_PROC(fldChangedEvent,ConfirmationEditHandler)
MAP_EVENT_PROC(penDownEvent,ConfirmationPenDownHandler)
MAP_EVENT_PROC(ctlSelectEvent,ConfirmationCommandHandler)
MAP_EVENT_PROC(frmCloseEvent,OnConfirmationCloseEvent)
MAP_EVENT_PROC(frmOpenEvent,OnConfirmationOpenEvent)
END_EVENT_MAP()
/******************************************************************************/
/* Command map for ConfirmationCommandHandler */
BEGIN_COMMAND_MAP(ConfirmationCommandHandler)
MAP_COMMAND_PROC_WB(ConfirmationbtnFirst,OnConfirmationbtnFirstClick)
MAP_COMMAND_PROC_WB(ConfirmationbtnPrev,OnConfirmationbtnPrevClick)
MAP_COMMAND_PROC_WB(ConfirmationbtnLast,OnConfirmationbtnLastClick)
MAP_COMMAND_PROC_WB(ConfirmationbtnNext,OnConfirmationbtnNextClick)
MAP_COMMAND_PROC_WB(ConfirmationbtnUpdate,OnConfirmationbtnUpdateClick)
MAP_COMMAND_PROC_WB(ConfirmationbtnBack,OnConfirmationbtnBackClick)
MAP_COMMAND_PROC_WB(ConfirmationIDC_DATE_TIME1,OnConfirmationIDC_DATE_TIME1Select)
END_COMMAND_MAP()
/******************************************************************************/
/* Edit map for ConfirmationEditHandler */
BEGIN_EDIT_MAP(ConfirmationEditHandler)
CASE(ConfirmationPackageID)
MAKE_EDIT(ConfirmationPrimaryRs)
CASE(ConfirmationSenderName)
MAKE_EDIT(ConfirmationPrimaryRs)
CASE(ConfirmationSenderAdd1)
MAKE_EDIT(ConfirmationPrimaryRs)
CASE(ConfirmationReceiverName)
MAKE_EDIT(ConfirmationPrimaryRs)
CASE(ConfirmationRecComments)
MAKE_EDIT(ConfirmationPrimaryRs)
END_EDIT_MAP()
/******************************************************************************/
/* Pendown map for ConfirmationPenDownHandler */
BEGIN_PENDOWN_MAP(ConfirmationPenDownHandler)
MAP_PENDOWN(ConfirmationSignature,&ConfirmationPrimaryRs)
END_PENDOWN_MAP()
Boolean OnConfirmationbtnFirstClick(EventPtr event)
{
if(EVP__IS_EDIT(ConfirmationPrimaryRs))
{
EVP__UPDATE(ConfirmationPrimaryRs)
}
EVP__MOVE_FIRST(ConfirmationPrimaryRs)
return true;
}
Boolean OnConfirmationbtnPrevClick(EventPtr event)
{
if(EVP__IS_EDIT(ConfirmationPrimaryRs))
{
EVP__UPDATE(ConfirmationPrimaryRs)
}
EVP__MOVE_PREV(ConfirmationPrimaryRs)
return true;
}
Boolean OnConfirmationbtnLastClick(EventPtr event)
{
if(EVP__IS_EDIT(ConfirmationPrimaryRs))
{
EVP__UPDATE(ConfirmationPrimaryRs)
}
EVP__MOVE_LAST(ConfirmationPrimaryRs)
return true;
}
Boolean OnConfirmationbtnNextClick(EventPtr event)
{
if(EVP__IS_EDIT(ConfirmationPrimaryRs))
{
EVP__UPDATE(ConfirmationPrimaryRs)
}
EVP__MOVE_NEXT(ConfirmationPrimaryRs)
return true;
}
Boolean OnConfirmationbtnUpdateClick(EventPtr event)
{
EVP__UPDATE(ConfirmationPrimaryRs)
return true;
}
Boolean OnConfirmationbtnBackClick(EventPtr event)
{
if(EVP__IS_EDIT(ConfirmationPrimaryRs))
{
EVP__UPDATE(ConfirmationPrimaryRs)
}
CLOSEFORM(Confirmation_FRM)
return true;
}
Boolean OnConfirmationIDC_DATE_TIME1Select(EventPtr event)
{
if(evp_SelectDay(&ConfirmationVar.m_IDC_DATE_TIME1))
{
SetDate(&ConfirmationVar.m_IDC_DATE_TIME1,ConfirmationIDC_DATE_TIME1);
EVP__EDIT(ConfirmationPrimaryRs)
}
return true;
}
static void ClearForm()
{
StrCopy(ConfirmationVar.m_PackageID, "");
StrCopy(ConfirmationVar.m_SenderName, "");
StrCopy(ConfirmationVar.m_SenderAdd1, "");
StrCopy(ConfirmationVar.m_RecName, "");
StrCopy(ConfirmationVar.m_RecComments, "");
ConfirmationVar.m_Signature = 0;
TimSecondsToDateTime(TimGetSeconds(), &ConfirmationVar.m_IDC_DATE_TIME1);
DoDataExchange(false);
}
static void DoDataExchange(Boolean bUpdate)
{
DDX_Text(bUpdate, ConfirmationVar.m_PackageID, ConfirmationPackageID);
DDX_Text(bUpdate, ConfirmationVar.m_SenderName, ConfirmationSenderName);
DDX_Text(bUpdate, ConfirmationVar.m_SenderAdd1, ConfirmationSenderAdd1);
DDX_Text(bUpdate, ConfirmationVar.m_RecName, ConfirmationReceiverName);
DDX_Text(bUpdate, ConfirmationVar.m_RecComments, ConfirmationRecComments);
DDX_Image(bUpdate, &ConfirmationVar.m_Signature, ConfirmationSignature, -1);
SetDate(&ConfirmationVar.m_IDC_DATE_TIME1, ConfirmationIDC_DATE_TIME1);
}
static void DoFieldExchange(Boolean bUpdate)
{
if(0 == EVP__MAX_RECORD(ConfirmationPrimaryRs))
{
MessageBox("Table is empty",MB_OK);
return;
}
if(bUpdate)
{
EVP__GET_FIELD_VALUE_STRING(ConfirmationPrimaryRs, 0, ConfirmationVar.m_PackageID)
EVP__GET_FIELD_VALUE_STRING(Customer, 1, ConfirmationVar.m_SenderName)
EVP__GET_FIELD_VALUE_STRING(Customer, 2, ConfirmationVar.m_SenderAdd1)
EVP__GET_FIELD_VALUE_STRING(Receiver, 1, ConfirmationVar.m_RecName)
EVP__GET_FIELD_VALUE_STRING(ConfirmationPrimaryRs, 5, ConfirmationVar.m_RecComments)
EVP__GET_FIELD_VALUE_IMAGE(ConfirmationPrimaryRs, 4, ConfirmationVar.m_Signature)
EVP__GET_FIELD_VALUE_DATETIME(ConfirmationPrimaryRs, 3, ConfirmationVar.m_IDC_DATE_TIME1)
}
else
{
EVP__SET_FIELD_VALUE_STRING(ConfirmationPrimaryRs, 0, ConfirmationVar.m_PackageID)
EVP__SET_FIELD_VALUE_STRING(Customer, 1, ConfirmationVar.m_SenderName)
EVP__SET_FIELD_VALUE_STRING(Customer, 2, ConfirmationVar.m_SenderAdd1)
EVP__SET_FIELD_VALUE_STRING(Receiver, 1, ConfirmationVar.m_RecName)
EVP__SET_FIELD_VALUE_STRING(ConfirmationPrimaryRs, 5, ConfirmationVar.m_RecComments)
EVP__SET_FIELD_VALUE_IMAGE(ConfirmationPrimaryRs, 4, ConfirmationVar.m_Signature)
EVP__SET_FIELD_VALUE_DATETIME(ConfirmationPrimaryRs, 3, ConfirmationVar.m_IDC_DATE_TIME1)
}
}
static void ExchangeRecValue(Boolean bUpdate)
{
if(bUpdate)
{
DoFieldExchange(true);
DoDataExchange(false);
}
else
{
DoDataExchange(true);
DoFieldExchange(false);
}
}
/******************************************************************************/
/* FUNCTION : ReceiverWhere */
/* ABSTRACT : Code to check the where clause */
/* Package.ReceiverID = Receiver.ReceiverID */
/******************************************************************************/
static Boolean ReceiverWhere()
{
Boolean status = false;
Char Package_ReceiverID[101];
Char Receiver_ReceiverID[101];
EVP__GET_FIELD_VALUE_STRING(ConfirmationPrimaryRs, 2, Package_ReceiverID)
EVP__GET_FIELD_VALUE_STRING(Receiver, 0, Receiver_ReceiverID)
if (CMP_EQ_STR(Package_ReceiverID,Receiver_ReceiverID)) status = true;
return status;
}
/******************************************************************************/
/* FUNCTION : CustomerWhere */
/* ABSTRACT : Code to check the where clause */
/* Package.SenderID = Customer.CustId */
/******************************************************************************/
static Boolean CustomerWhere()
{
Boolean status = false;
Char Package_SenderID[101];
Char Customer_CustId[101];
EVP__GET_FIELD_VALUE_STRING(ConfirmationPrimaryRs, 1, Package_SenderID)
EVP__GET_FIELD_VALUE_STRING(Customer, 0, Customer_CustId)
if (CMP_EQ_STR(Package_SenderID,Customer_CustId)) status = true;
return status;
}
static void PackageLink()
{
EVP__MOVE_FIRST(Receiver)
EVP__MOVE_FIRST(Customer)
}
Boolean OnConfirmationCloseEvent(EventPtr event)
{
EVP__CLOSE_TABLE(Receiver)
EVP__CLOSE_TABLE(Customer)
EVP__CLOSE_TABLE(ConfirmationPrimaryRs)
return false;
}
Boolean OnConfirmationOpenEvent(EventPtr event)
{
DRAWFORM
WinDrawRectangleFrame(simpleFrame, &SignatureRect);
TimSecondsToDateTime(TimGetSeconds(), &ConfirmationVar.m_IDC_DATE_TIME1);
EVP__INITIALIZE_RECORDSET(ConfirmationPrimaryRs,Package_db)
EVP__REGISTER_QUERY_FUNC(Receiver,ReceiverWhere)
EVP__REGISTER_QUERY_FUNC(Customer,CustomerWhere)
EVP__REGISTER_LINK_FUNC(ConfirmationPrimaryRs,PackageLink)
EVP__REGISTER_UPDATE_FUNC(ConfirmationPrimaryRs,ExchangeRecValue)
EVP__REGISTER_CLEAR_FUNC(ConfirmationPrimaryRs,ClearForm)
EVP__INITIALIZE_RECORDSET(Receiver,Receiver_db)
EVP__OPEN_TABLE_QUERY(Receiver)
EVP__INITIALIZE_RECORDSET(Customer,Customer_db)
EVP__OPEN_TABLE_QUERY(Customer)
EVP__OPEN_TABLE(ConfirmationPrimaryRs)
return true;
}