// BillView.prg
//
#INCLUDE "FIVEWIN.CH"
#Include "xBrowse.Ch"
//----------------------
FUNC _BillView( cMODE,oRsBill,oFontB,oBtn0,oBtn1,oBtn2,oBtn3,oBtn4,oBtn13 )
LOCAL SAYING, oUSERS, lOK, oBmp,oLbxD
LOCAL lOK1,oButt1,oButt2,cTitle
Local dBillDate,nInvoiceNumber,cPublication,cDescription,nAmountDue,nBills,cDetail
Local oBillDate,oInvoiceNumber,oPublication,oDescription,oAmountDue,oBills,oDetail
Local oSay1,oSay2,oSay3,oSay4,oSay5,oSay6,oSay7,oSay8,oSay9
Local oRsBillDetail,cSql,oErr,nRn
Local cAdName,oAdName
Local oDueDate,dDueDate,oTerms,cTerms
IF oRsBill:EOF
SAYING := "SORRY ... No Billing Information to View"
MsgInfo( SAYING )
RETURN(.F.)
ENDIF
cMode := "V"
nRn := oRsBill:Fields("Rn"):Value
oRsBillDetail := TOleAuto():New( "ADODB.Recordset" )
oRsBillDetail:CursorType := 1 // opendkeyset
oRsBillDetail:CursorLocation := 3 // local cache
oRsBillDetail:LockType := 3 // lockoportunistic
cSql := "Select * from [BillingDetail] where [Rn] = "+ltrim(str(nRn))
cSql += " Order By [PublicationName],[Week]"
TRY
oRsBillDetail:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening BillingDetail table" )
RETURN(.F.)
END TRY
oBtn0:Disable()
oBtn1:Disable()
oBtn2:Disable()
oBtn3:Disable()
oBtn4:Disable()
oBtn13:Disable()
LightGreenGrad()
dBillDate := If(empty(oRsBill:Fields("BillDate"):Value),Ctod(""),;
TtoDate(oRsBill:Fields("BillDate"):Value ))
nInvoiceNumber := If(empty(oRsBill:Fields("InvoiceNumber"):Value),0,;
oRsBill:Fields("InvoiceNumber"):Value)
cPublication := If(empty(oRsBill:Fields("PublicationName"):Value),space(50),;
oRsBill:Fields("PublicationName"):Value)
cDescription := If(empty(oRsBill:Fields("Description"):Value),space(50),;
oRsBill:Fields("Description"):Value)
cAdName := If(empty(oRsBill:Fields("AdName"):Value),space(50),;
oRsBill:Fields("AdName"):Value )
nAmountDue := If(empty(oRsBill:Fields("AmountDue"):Value),0,;
oRsBill:Fields("AmountDue"):Value)
nBills := If(empty(oRsBill:Fields("Bills"):Value),0,;
oRsBill:Fields("Bills"):Value)
dDueDate := If(empty(oRsBill:Fields("DueDate"):Value),Ctod(""),;
TtoDate(oRsBill:Fields("DueDate"):Value ))
cTerms := If(empty(oRsBill:Fields("Terms"):Value),space(15),;
oRsBill:Fields("Terms"):Value)
cTITLE := "Billing-Invoicing Information"
DO CASE
CASE cMODE = "A"
cTITLE := "Billing-Invoicing Information ADD"
CASE cMODE = "E"
cTITLE := "Billing-Invoicing Information EDIT"
CASE cMODE = "V"
cTITLE := "Billing-Invoicing Information VIEW"
ENDCASE
lOK := .F.
DEFINE BITMAP oBmp RESOURCE "BILLVIEW"
DEFINE DIALOG oUSERS RESOURCE "BILLVIEW" ;
TITLE cTITLE
REDEFINE SAY oSay1 ID 115 OF oUsers UPDATE // billdate
oSay1:SetFont( oFontB )
REDEFINE SAY oSay2 ID 117 OF oUsers UPDATE // invoice number
oSay2:SetFont( oFontB )
REDEFINE SAY oSay3 ID 119 OF oUsers UPDATE // publication
oSay3:SetFont( oFontB )
REDEFINE SAY oSay4 ID 128 OF oUsers UPDATE // description
oSay4:SetFont( oFontB )
REDEFINE SAY oSay5 ID 113 OF oUsers UPDATE // ad campaign
oSay5:SetFont( oFontB )
REDEFINE SAY oSay6 ID 123 OF oUsers UPDATE // amount due
oSay6:SetFont( oFontB )
REDEFINE SAY oSay7 ID 125 OF oUsers UPDATE // number bills
oSay7:SetFont( oFontB )
REDEFINE SAY oSay8 ID 129 OF oUsers UPDATE // due date
oSay8:SetFont( oFontB )
REDEFINE SAY oSay9 ID 121 OF oUsers UPDATE // terms
oSay9:SetFont( oFontB )
REDEFINE xBROWSE oLbxD ;
RECORDSET oRsBillDetail ;
COLUMNS "PUBLICATIONNAME", ;
"DESCRIPTION", ;
"TOTALBILLED" ;
COLSIZES 160,155,75 ;
HEADERS "Publication", ;
"Description", ;
"Billed" ;
ID 111 of oUsers ;
AUTOCOLS LINES CELL
oLbxD:lRecordSelector := .f.
oLbxD:lHScroll := .f. // turn off horiz scroll bar
_BrowColor(oLbxD)
REDEFINE GET oBillDate VAR dBillDate ID 116 of oUSERS COLOR "N/W" READONLY
REDEFINE GET oDueDate VAR dDueDate ID 114 of oUSERS COLOR "N/W" READONLY
REDEFINE GET oInvoiceNumber VAR nInvoiceNumber ID 118 of oUSERS PICTURE "999999999999" COLOR "N/W" READONLY
REDEFINE GET oTerms VAR cTerms ID 122 of oUSERS COLOR "N/W" READONLY
REDEFINE GET oPublication VAR cPublication ID 120 of oUSERS COLOR "N/W" READONLY
REDEFINE GET oAdName VAR cAdName ID 112 of oUSERS COLOR "N/W" READONLY
REDEFINE GET oDescription VAR cDescription ID 127 of oUSERS COLOR "N/W" READONLY
REDEFINE GET oAmountDue VAR nAmountDue ID 124 of oUSERS PICTURE "99999999.99" COLOR "N/W" READONLY
REDEFINE GET oBills VAR nBills ID 126 of oUSERS PICTURE "9999" COLOR "N/W" READONLY
REDEFINE BTNBMP oButt1 ID 150 of oUSERS ; // ok
RESOURCE "OK", "DOK", "DOK" ;
PROMPT " &Ok " LEFT 2007;
ACTION (lOK := .T., oUsers:END())
REDEFINE BTNBMP oButt2 ID 160 of oUSERS ; // cancel
RESOURCE "CANCEL", "DCANCEL", "DCANCEL" ;
PROMPT "&Cancel " LEFT 2007;
ACTION ( lOk := .f., oUSERS:END())
ACTIVATE DIALOG oUSERS ;
ON INIT (oLbxD:SetFocus() );
ON PAINT (PalBmpDraw( hDC, 0, 0, oBmp:hBitmap ))
oRsBillDetail:CLose()
oRsBillDetail := nil
LightGreyGrad()
oBmp:End()
oBtn0:Enable()
oBtn1:Enable()
oBtn2:Enable()
oBtn3:Enable()
oBtn4:Enable()
oBtn13:Enable()
RETURN(.t. )
//--------------
Static Func LightGreenGrad()
SetDlgGradient( { { .50, nRGB(210,235,216), nRGB( 255, 255, 255 ) } } )
Return(nil)
//------------------
Static Func LightGreyGrad()
SetDlgGradient( { { .50, nRGB( 216, 216, 216 ), nRGB( 255, 255, 255 ) } } )
Return(nil)
//-------------------
Static Func _BrowColor( oLbx )
// foreground // background
local aGradBarSelFocus := {{1, RGB(0,128,255) , RGB(0,128,255) }} // in focus
local aGradBarSel := {{1, RGB(255,255,255), RGB(192,192,192) }} // not in focus 192
WITH OBJECT oLbx
:bClrSel := {|| { CLR_BLACK, aGradBarSel } } // not in focus
:bClrSelFocus := { || { CLR_WHITE, aGradBarSelFocus } } // in focus
END
Return(nil)
// end BillView.prg