Ola!
Apenas um pedaço, para dar uma ideia ao pessoal. O resto é muito similar...
#include "rddleto.ch"
#include "hbwin.ch"
MEMVAR _SERVER, _REQUEST, _GET, _POST, _COOKIE, _SESSION, _HTTP_REQUEST, _HTTP_RESPONSE
REQUEST DBFNTX, DBFCDX, DBFFPT, DBFDBT, LETO
REQUEST HB_LANG_PT,HB_CODEPAGE_PTISO,HB_CODEPAGE_PT850
FUNCTION HRBMAIN(...)
LOCAL cHtml := "", aOBS:={}, cOBS := "", nRec, cPATH := "//localhost:2812/"
LOCAL cLogin := cSenha := cCodGarcon := cGarcon := "", nC
LOCAL cStr := cCodGrupo := cGrupo:= "", cSection, cKey, cEOL := hb_eol()
Local hINI := hb_IniRead("\xxx\sistema.ini")
Local cHost := cSetor := cPadrao := cCodCliente := cCliente := cEscolha := ""
Local nQtd := 1, nTotal := nComissao := 0, cCargo := cCodVendedor := ""
cPDV := uhttpd_GetField( "cPDV" )
cLogin := uhttpd_GetField( "cLogin" )
cSenha := uhttpd_GetField( "cSenha" )
cCargo := uhttpd_GetField( "cCargo" )
cCodCliente := uhttpd_GetField( "cCodCliente" )
cCliente := uhttpd_GetField( "cCliente" )
aCodProduto := uhttpd_GetField( "aCodProduto" )
cCodProduto := uhttpd_GetField( "cCodProduto" )
aObs := uhttpd_GetField( "aObs" )
cCodVendedor := uhttpd_GetField( "cCodVendedor" )
aQtd := uhttpd_GetField( "aQtd" )
cHost := uhttpd_GetField( "cHost" )
nReg := uhttpd_GetField( "nReg" )
cEscolha := uhttpd_GetField( "cEscolha" )
hb_default( @cPDV , "" )
hb_default( @cLogin, "" )
hb_default( @cSenha, "" )
hb_default( @cCargo, "" )
hb_default( @cCodCliente, "" )
hb_default( @cCliente, "" )
hb_default( @cCodVendedor, "" )
hb_default( @cHost, "" )
hb_default( @cEscolha, "" )
If cEscolha == "GRUPOS" .OR. cEscolha == "GRAVOU"
cHtml += '<!DOCTYPE html>' + cEOL
cHtml += '<html lang="pt-BR">' + cEOL
cHtml += '<head>' + cEOL
cHtml += '<title>Sistema xxx Web</title>' + cEOL
cHtml += '<meta charset="WINDOWS-1252" />' + cEOL
cHtml += '</head>'+ cEOL
cHtml += '<form name="fechar" action="/cgi-bin/grupos.hrb" method="post">' + cEOL
cHtml += '<input type="hidden" name="cCodVendedor" value="' + cCodVendedor + '">' + cEOL
cHtml += '<input type="hidden" name="cPDV" value="' + cPDV + '">' + cEOL
cHtml += '<input type="hidden" name="cLogin" value="' + cLogin + '">' + cEOL
cHtml += '<input type="hidden" name="cSenha" value="' + cSenha + '">' + cEOL
cHtml += '<input type="hidden" name="cCargo" value="' + cCargo + '">' + cEOL
cHtml += '<input type="hidden" name="cEscolha" value="' + cEscolha + '">' + cEOL
cHtml += '<input type="hidden" name="cHost" value="' + cHost + '">' + cEOL
cHtml += '</form> <script>document.fechar.submit(); </script></html>'
Return cHtml
EndIf
//Quando for apenas um item!!!
If hb_IsArray(aCodProduto)
Else
If Empty(cCodProduto)
If Len(aCodProduto) = 1
cCodProduto := aCodProduto[1]
Else
Return html_erro("Informe um produto.")
EndIf
EndIf
aCodProduto := {}
AAdd(aCodProduto,cCodProduto)
// Return html_erro(cCodProduto + "--" + aCodProduto[1])
EndIf
//Return html_erro(hb_ValToExp(aCodProduto) + "--" + hb_ValToExp(aQtd)+"--"+hb_ValToExp(aObs))
If hb_IsArray(aObs)
Else
cOBS := IIF( ValType(aOBS) <> "C", "",aOBS)
aObs := {}
AAdd(aObs,cObs) //
EndIf
If hb_IsArray(aQtd)
Else
nQtd := aQtd
IF Empty(nQtd)
Return html_erro("Informe a Quantidade.")
EndIf
aQtd := {}
AAdd(aQtd,nQtd) //IIF( ValType(aQtd) == "C", IIF(Val(aQtd)==0,1,Val(aQtd)), 1)
EndIf
//cLogin := cripto(AllTrim(cLogin),.f.)
//cSenha := cripto(AllTrim(cSenha),.f.)
HB_CDPSELECT([PTISO])
hb_langselect([PT])
Set Deleted On
RDDSetDefault("LETO")
If select('eq') > 0
eq->(DBCloseArea())
EndIf
cIndex := cPATH+"estoque.cdx"
DbUseArea(.t.,'LETO',cPATH+"estoque.dbf","eq",.T.,.F.,'PTISO')
DBSETINDEX( cIndex )
eq->(OrdSetFocus(2)) //cod_mercad
//If eq->(DBSeek(cCodProduto))
//Else
// Return html_erro("Falha procurando: "+cCodProduto)
//EndIf
If select('pdv') > 0
pdv->(DBCloseArea())
EndIf
cIndex := cPATH+"pdv"+cPDV+".cdx"
cDbPDV := cPATH+"pdv"+cPDV+".dbf"
If leto_file(cDbPDV)
Else
dbCreate(cDbPDV,Estrutura_pdv(),"LETO",.T.,"PDV")
index on cod_mercad tag tag01
index on areaPrint tag tag02
pdv->(DBCloseArea())
EndIf
DbUseArea(.t.,'LETO',cDbPDV,"pdv",.T.,.F.,'PTISO')
If leto_file(cIndex) //não precisa leto_file!
DBSETINDEX( cIndex )
Else
index on cod_mercad tag tag01
index on areaPrint tag tag02
EndIf
cHora := StrTran(FusoHorario(cPATH),":","")
pdv->(OrdSetFocus(1)) //cod_mercad
For nC := 1 to Len(aCodProduto) //Val(nReg)
If Empty( Val(aQtd[nC]) )
//If Empty(cCodProduto)
Loop
//Else
// nQtd := 1
//EndIf
Else
nQtd := Val(aQtd[nC])
EndIf
If eq->(DBSeek(aCodProduto[nC]))
cProduto := eq->mercadoria
cPreco := eq->avista
nArea := eq->areaprint
cCodForn := eq->cod_fornec
cCodGrupo := eq->cod_grupo
EndIf
If incluir('pdv')
If MyRlock('pdv')
pdv->mesa := cPDV
pdv->cod_client := IIF(Empty(cCodCliente),"000000",cCodCliente)
pdv->cliente := IIF(Empty(cCliente),"CONSUMIDOR DIVERSOS",cCliente)
pdv->cod_client := cCodCliente
pdv->cliente := cCliente
pdv->cod_grupo := cCodGrupo
pdv->cod_mercad := aCodProduto[nC]
pdv->mercadoria := alltrim(cProduto)
pdv->quantidade := Abs(nQtd)
pdv->preco_unit := cPreco
pdv->cod_vended := cCodVendedor
pdv->vendedor := cLogin
pdv->data_compr := Date()
pdv->hora := cHora
pdv->obscozinha := aOBS[nC]
pdv->qtdcomanda := Abs(nQtd)
pdv->areaprint := nArea
pdv->comandado := 'N'
pdv->cod_setor := cSetor
EndIf
Else
eq->(DBCloseArea())
Return html_erro("Falha incluindo: "+cPDV)
EndIf
Next
eq->(DBCloseArea())
//cLoginCripto := cLogin //cripto(cLogin,.T.)
//cSenhaCripto := cSenha //cripto(cSenha,.T.)
pdv->(DbCloseArea())
cEscolha := "GRAVOU"
cHtml := PDVProdutosVer(cPATH,cPDV,cCodVendedor,cLogin,cSenha,cCargo,cCodCliente,cCLiente,cHost,cEscolha)
Return cHtml
SET PROCEDURE TO "lib.prg"
Obs. Tem partes que o pulo do gato está na HTML5.
Enfim, fica muito bom com rede Wireless interna, (particular) sem deixar os clientes, acessar.(melhor no restaurante usar 2 redes)
Saudações,
Itamar M. Lins Jr.