by cdmmaui » Sun Jan 25, 2015 1:49 pm
Hi Antonio,
Here is PRG:
#include "adsdbe.ch"
#include "ads.ch"
#include "\CLIPWEB\INCLUDE\CLIPWEB.H"
#include "cdm.h"
FUNCTION MAIN( cIniFile )
LOCAL oSession , ;
nCnt := 0 , ;
lPass := .F. , ;
cUID := '' , ;
cPID := '' , ;
cName := '' , ;
aUserPerm := {}
// Init...
CgiInit()
IF cIniFile != Nil
nHOut :=cgiForm(cIniFile)
else
RETURN Void
ENDIF
// Init...
SET EPOCH TO 1980
SET DATE FORMAT TO "MM/DD/YYYY"
SET EXCLUSIVE OFF
SET DELETED ON
SET DECIMALS TO 2
// Init...
cUID := _CgiGet( 'userid' )
cPID := _CgiGet( 'password' )
cUTYPE := "OPERATIONS"
cCID := ""
cULID := ""
cHdr := "#2B60DE"
cHdrTxt := "#000000"
cTable := '#BBBBFF'
cHover := '#6699CC'
cColOn := '#BBFFFF'
cColOff := '#BBBBFF'
cBkgrnd := ''
cTtlCol := '#2B60DE'
cTtlFnt := 'tahoma'
cTBback := '#2B60DE'
cTBtext := '#FFFFFF'
cPBback := '#254117'
cPBtext := '#FFFFFF'
cCricol := '#2B60DE'
cCWcol := '#2B60DE'
cDE01 := '#2B60DE'
cDE02 := '#2B60DE'
cDE03 := '#2B60DE'
cDE04 := '#2B60DE'
cDE05 := '#2B60DE'
cDE06 := '#2B60DE'
cDE07 := '#2B60DE'
cDE08 := '#2B60DE'
cDE09 := '#2B60DE'
cLogo := ""
cWid := "100"
cHgt := "100"
cComp := ""
lLink := .F.
cLastD := ""
cLastT := ""
nRowMax := nMax // 13
nRowCnt := 0
IF 'LINK=' $ cQueryString
lLink := .T.
lStart := .F.
cUID := ''
FOR nX=1 TO LEN( cQueryString )
cChar := SUBSTR( cQueryString, nX, 1 )
DO CASE
CASE cChar='='
lStart := .T.
CASE cChar='&'
EXIT
CASE lStart
cUID += cChar
ENDCASE
NEXT nX
ENDIF
// Default...
put( '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' )
put( '<html>' )
put( '<head>' )
put( '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />')
put( [<title>] + cTitle + [</title>] )
put( '<meta name="Description" content="U.S. Customs certified software provider for freight forwarders, NVOCC and logistics companies"/>')
put( '<meta name="Keywords" content="RFID, Asset, Asset Management, Inspection, Certification, Maintenance, Barcode"/>')
put( '<link REL="SHORTCUT ICON" HREF="http://www.isfsoftware.com/cdm.ico">' )
put( '<link media="screen" rel="stylesheet" type="text/css" href="css/style.css" />' )
put( '</head>' )
put( '<body>' )
SET DEFAULT TO ( cRoot )
// connect to the ADS server
IF lAds
oSession := dacSession():New( "ADSDBE", cRoot )
// check if we are connected to the ADS server
IF ( ! oSession:isConnected( ) )
_AdsErr( LTRIM( STR( oSession:getLastError(), 9 ) ) )
RETURN Void
ENDIF
// use FPT/CDX compatible files
DbeInfo( COMPONENT_DATA, ADSDBE_TBL_MODE , ADSDBE_CDX)
DbeInfo( COMPONENT_ORDER, ADSDBE_INDEX_EXT, "CDX")
ENDIF
// Load Profile...
IF ! _LoadProfile()
_AdsOpenErr( cRoot, 'aimmgr', oSession )
RETURN Void
ENDIF
// User...
lPass := _UserDetails( lLink, cUID, cPID, @cName, @cUTYPE, @cCID, @cULID, @cLastD, @cLastT, .T. )
IF ! lPass
_LoginError( cUID + IF( lLink, "--LINK=YES", "--LINK=NO"), oSession )
RETURN Void
ENDIF
// User Permissions...
aUserPerm := _UserAccess( cUID, "DASHBOARD" )
// Open...
_db( cRoot, 'job' )
_db( cRoot, 'maint' )
put( [<div id="wrapper">] )
put( [ <div id="head">] )
put( [ <div id="logo_user_details">] )
put( [ <h1 id="logo"><a href="#"><img src="images/logo.jpg" alt=""></a></h1>] )
put( [ <div id="user_details">] )
put( [ <ul id="user_details_menu">] )
put( [ <li>Welcome <strong>] + cName + [</strong></li>] )
put( [ <li class="user_details_menu_options">] )
put( [ <ul id="user_access">] )
put( [ <li class="first"><a target="_blank" href="aim.pdf">User Guide</a></li>] )
put( [ <li class="user_access_line">|</li>] )
put( [ <li class="last"><a href="login.htm">Log out</a></li>] )
put( [ </ul>] )
put( [ </li>] )
put( [ </ul>] )
put( [ </div>] )
put( [ </div>] )
put( [ </div>] )
put( [ <div id="content">] )
put( [ <div id="page">] )
put( [ <div class="inner">] )
put( [ <div class="section table_section">] )
put( [ <div class="title_wrapper">] )
put( [ <h2>] + cClientName + [ Asset Manager 2014</h2>] )
put( [ </div>] )
put( [ <div class="section_content">] )
put( [ <div class="section_content_padding">] )
put( [ <div class="dashboard_menu_wrapper">] )
put( [ <ul class="dashboard_menu">] )
IF aUserPerm[01] .AND. (cClient=="NOBLE")
put( [ <li><a class="noble" href="job.dll?LINK=] + cUid + ["><span>Service Calls</span></a></li>] )
ENDIF
IF aUserPerm[02]
put( [ <li><a class="item" href="product.dll?LINK=] + cUid + ["><span>Asset List</span></a></li>] )
ENDIF
IF aUserPerm[03] .AND. (cClient=="NOBLE")
put( [ <li><a class="d14" href="insp.dll?LINK=] + cUid + ["><span>Inspections</span></a></li>] )
ENDIF
IF aUserPerm[04]
put( [ <li><a class="service" href="maint.dll?LINK=] + cUid + ["><span>Maintenance</span></a></li>] )
ENDIF
IF aUserPerm[05]
put( [ <li><a class="event" href="event.dll?LINK=] + cUid + ["><span>Events</span></a></li>] )
ENDIF
IF aUserPerm[06]
put( [ <li><a class="d12" href="report.dll?LINK=] + cUid + ["><span>Reports</span></a></li>] )
ENDIF
IF aUserPerm[07]
put( [ <li><a class="edit" href="codes.dll?LINK=] + cUid + ["><span>Codes</span></a></li>] )
ENDIF
IF "ADMIN" $ cUType
put( [ <li><a class="d1" href="user.dll?LINK=] + cUid + ["><span>Security</span></a></li>] )
ENDIF
put( [ </ul>] )
put( [ </div>] )
put( [ </div>] )
put( [ </div>] )
put( [ </div>] )
put( [ <div class="section table_section">] )
DO CASE
CASE cClient=="NOBLE"
put( [ <div class="title_wrapper">] )
put( [ <h2>Service Calls</h2>] )
put( [ </div>] )
put( [ <div class="section_content">] )
put( [ <div class="table_wrapper">] )
put( [ <div class="table_wrapper_inner" style="padding:0;">] )
put( [ <table>] )
put( [ <tr>] )
put( [ <th><a href="javascript:void(0);">Job No.</a></th>] )
put( [ <th><a href="javascript:void(0);">Job Date</a></th>] )
put( [ <th><a href="javascript:void(0);">Job Site</a></th>] )
put( [ <th><a href="javascript:void(0);">Location</a></th>] )
put( [ <th><a href="javascript:void(0);">Customer</a></th>] )
put( [ <th><a href="javascript:void(0);">Customer PO</a></th>] )
put( [ <th><a href="javascript:void(0);">Call Type</a></th>] )
put( [ <th><a href="javascript:void(0);">Call Status</a></th>] )
put( [ </tr>] )
SELECT job
SET ORDER TO TAG S4
GO TOP
SEEK "OPEN"
DO WHILE ! EOF() .AND. (nRowCnt<nRowMax) .AND. ( ALLTRIM( job->callstat )=="OPEN" )
IF ! cUTYPE $ "SYSADMIN,CUSTADMIN,DISTRICTMGR"
IF ALLTRIM( job->location ) <> cULID
SKIP
LOOP
ENDIF
ENDIF
put( [<tr>] )
// Data...
cDat := ALLTRIM( UPPER( job->jobno ) )
IF EMPTY( cDat )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := DTOC( job->jobdate )
IF EMPTY( cDat )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := ALLTRIM( job->jobsite )
IF EMPTY( LEFT( cDat, 2 ) )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := ALLTRIM( job->location )
IF EMPTY( LEFT( cDat, 2 ) )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := ALLTRIM( job->custname )
IF EMPTY( cDat )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := ALLTRIM( job->custpo )
IF EMPTY( cDat )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := ALLTRIM( job->calltype )
IF EMPTY( cDat )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := ALLTRIM( job->callstat )
IF EMPTY( cDat )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
put( [</tr>] )
// Counter...
nRowCnt++
SELECT job
SKIP
ENDDO
put( [ </table>] )
put( [ </div>] )
put( [ </div>] )
put( [ </div>] )
OTHERWISE
put( [ <div class="title_wrapper">] )
put( [ <h2>Last Maintenance Records</h2>] )
put( [ </div>] )
put( [ <div class="section_content">] )
put( [ <div class="table_wrapper">] )
put( [ <div class="table_wrapper_inner" style="padding:0;">] )
put( [ <table>] )
put( [ <tr>] )
put( [ <th><a href="javascript:void(0);">Car No.</a></th>] )
put( [ <th><a href="javascript:void(0);">Style</a></th>] )
put( [ <th><a href="javascript:void(0);">Date of Service</a></th>] )
put( [ <th><a href="javascript:void(0);">Technician</a></th>] )
put( [ <th><a href="javascript:void(0);">Status</a></th>] )
put( [ </tr>] )
SELECT maint
SET ORDER TO TAG S1
GO TOP
DO WHILE ! EOF() .AND. (nRowCnt<nRowMax)
IF ! cUTYPE $ "SYSADMIN,CUSTADMIN,DISTRICTMGR"
IF ALLTRIM( maint->location ) <> cULID
SKIP
LOOP
ENDIF
ENDIF
put( [<tr>] )
// Data...
cDat := ALLTRIM( UPPER( maint->assetno ) )
IF EMPTY( cDat )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := ALLTRIM( maint->assettype )
IF EMPTY( cDat )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := DTOC( maint->mntdate )
IF EMPTY( LEFT( cDat, 2 ) )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := ALLTRIM( maint->mntby )
IF EMPTY( LEFT( cDat, 2 ) )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
cDat := ALLTRIM( maint->mntstat )
IF EMPTY( cDat )
cDat := " "
ENDIF
put( [<td>] + cDat + [</td>] )
put( [</tr>] )
// Counter...
nRowCnt++
SELECT maint
SKIP
ENDDO
put( [ </table>] )
put( [ </div>] )
put( [ </div>] )
put( [ </div>] )
ENDCASE
put( [ </div>] )
put( [ </div>] )
put( [ </div>] )
put( [ </div>] )
put( [</div>] )
// Footer...
_CdmFooter()
put( [</body>] )
put( [</html>] )
IF lAds
oSession:disconnect()
ENDIF
DbCloseAll()
CloseCGISession()
RETURN Void