é facim, facim... desenha primeiro a etiqueta da forma que precisar.
Depois pedir p/ imprimir em arquivo, o programa da argox gera um arquivo texto, é só trocar as variaveis via programação.
Código: Selecionar todos
***************************
Function EtiquetaMenu(oBrw)
***************************
*
*
Local oDlg,oFont,cGet01:=cGet02:=eq->cod_mercad,nRec := 0, cModelo
Local cTitulo := "Etiquetas Argox", lOk:=.F., nOrd := eq->(OrdSetFocus(2)) //cod_mercad
Local oPrn, aPrn := WIN_PRINTERLIST(), nPrnD := aScan(aPrn,win_PrinterGetDefault()), cPrint
Private lQtd:=.F., nQtd:=1,nTemp:=17
If !en->(dbSeek('MOD'+'ETIQUETA'))
IncluirEntidade("MOD","ETIQUETA",'001')
cModelo := "001"
Else
cModelo := alltrim(en->dados)
EndIf
aModelo := { "001 Etiquetas Modelo 001",;
"002 Etiquetas Modelo 002",;
"003 Etiquetas Ótica/Jóias",;
"004 Etiquetas roupas",;
"005 Etiquetas Caixa " }
PREPARE FONT oFont NAME "MS Sans Serif" WIDTH 0 HEIGHT -14
INIT DIALOG oDlg CLIPPER NOEXIT TITLE cTitulo Font oFont AT 0,0 SIZE 350,330 STYLE DS_CENTER +WS_SYSMENU+WS_VISIBLE
@ 005,030 say "De:" size 050,15
@ 030,025 get oGet01 VAR cGet01 size 130,20 MAXLENGTH 13
@ 180,030 say "Até:" size 050,15
@ 210,025 get oGet02 VAR cGet02 size 130,20 MAXLENGTH 13
@ 005,065 get CheckBox oQtd Var lQtd Caption "Usar campo etiqueta" SIZE 150,25 Valid {||fChk001(lQtd,nQtd,oQtd,cGet01,cGet02)}
@ 005,105 say "Quantidade:" size 080,20
@ 090,100 get oQtd Var nQtd size 050,20 picture "999" //STYLE WS_DLGFRAME
@ 170,105 say "Temperatura:" size 080,20
@ 260,100 get oTemp Var nTemp size 040,20 picture "99" Valid {||ValidaTemperatura(nTemp)}
@ 005,140 say "Modelo Etiqueta:" size 150,25
@ 005,160 get ComboBox oModelo VAR cModelo ITEMS aModelo TEXT Size 330,30 DisplayCount 5 STYLE WS_TABSTOP
//@ 075,110 get ComboBox oRe04 var vRe04 ITEMS aFormVend[1] TEXT Size 180,20 DisplayCount 6 //On Change {|| oRe05:SetFocus(),.t.}
@ 005,200 say "Impressora de Etiqueta:" size 150,25
@ 005,220 ComboBox oPrn ITEMS aPrn Init nPrnD Size 330,30 DisplayCount 8 STYLE WS_TABSTOP
@ 040,260 Button oBtNo Caption 'Cancelar' Size 80,30 ON CLICK {||hwg_EndDialog()}
@ 210,260 Button oBtYes Caption 'Confirmar' Size 80,30 ON CLICK {||lOk:=.T.,hwg_EndDialog()}
oDlg:Activate()
If !lOk
oBrw:Refresh()
Return nil
EndIf
cModelo := SubStr(cModelo,1,3)
//hwg_msginfo(cModelo)
If lQtd
cTemp := "etq001"+dtos(hb_datetime())
cQuery := "!empty(etiquetas)"
OrdBy := "cod_mercad"
tRec := eq->(OrdKeyCount())
oBar := HProgressBar():NewBox( "Ordenando, "+lTrim(str(nRec,9))+" De "+lTrim(str(tRec,9))+" Registro(s)",,,350,,tRec)
Index on &OrdBy to &cTemp for &cQuery temporary eval {||oBar:Step()}
//eq->(DbGoTop())
oBar:Close()
If eq->(Eof())
Close &cTemp
FechaDb('eq')
AbreDb('estoque.dbf','eq',.T.)
oBrw:Refresh()
hwg_msgstop("Nenhuma etiqueta informada.")
Return .F.
EndIf
Else
If Empty(cGet01) //.or. Empty(vGet02)
Hwg_msginfo("Informe um produto.")
lOk := .F.
Else
If eq->(dbSeek(cGet01))
If Empty(cGet02)
Hwg_msginfo("Informe um produto final.")
lOk := .F.
Else
//hwg_msginfo('ok')
eq->(OrdScope(0,cGet01))
eq->(OrdScope(1,cGet02))
tRec := eq->(OrdKeyCount())
eq->(dbGoTop())
IF eq->(bof()) .OR. eq->(Eof())
Hwg_MsgInfo("Nada p/ imprimir.")
lOK := .F.
ENDIF
//eq->(DbGoTop())
EndIf
Else
hwg_Msgstop("Código não localizado.")
lOk := .F.
EndIf
EndIf
EndIf
IF lOk
AbreDb('etiquetas.dbf','etq',.t.)
cArq := CriaArqImpressao("Argox.prn")
tRec := PrintArgox(cModelo)
ENDIF
FechaDb('eq')
AbreDb('estoque.dbf' ,'eq',.t.)
eq->(OrdSetFocus(nOrd))
eq->(DbGoTop())
oBrw:Refresh()
//Imprime(cArq,cPrint,"Etiquetas")
VerRelatorio(cArq,120,'C')
oBrw:Refresh()
hwg_Msginfo( 'Total impresso: '+Transform(tRec,'99999') )
Return .T.
**********************************************
Function fChk001(lQtd,nQtd,oQtd,cGet01,cGet02)
**********************************************
*
*
If lQtd
nQtd:=0
oQtd:Disable()
cGet01 := cGet02 := Space(13)
oGet01:SetText("")
oGet02:SetText("")
oGet01:Disable()
oGet02:Disable()
Else
nQtd:=1
oQtd:enable()
cGet01 := cGet02 := eq->cod_mercad
oGet01:SetText(cGet01)
oGet02:SetText(cGet01)
oGet01:Enable()
oGet02:Enable()
EndIf
oQtd:Refresh()
Return .T.
**********************************
Function ValidaTemperatura(nTemp)
**********************************
*
*
Local lRet := .f.
IF nTemp > 9 .AND. nTemp < 21
lRet := .t.
Else
hwg_Msginfo("O valor, deve ser de 10 até 20.")
Endif
Return lRet
Itamar M. Lins Jr.