Código: Selecionar todos
PROCEDURE IMP_AJUSWIN()
cDevOut := GetDefaultPrinter()
oPrint := Win32Prn():New(cDevOut) // Create Printer object
oPrint:Landscape := .F.
oPrint:FormType := 1 // FORM_LETTER
oPrint:Copies := 2
if !oPrint:Create()
Alert("Cannot Create Printer")
BREAK
End if
oPrint:SetFont('Lucida Console',9,{3,-50}, 0, .F., .F.)
oPrint:StartDoc()
LIN := 0
NTOTAL2 := 0
ntotal := 0
acumiva := 0
TITULOAJUSTEWIN()
FOR I = 1 TO LEN(MA)
IF MA[I,1] <> " " .AND. LEFT(MA[I,1],3) <> "ELI"
IF MA[I,26] = "C"
oPrint:SetPrc(oPrint:Prow()+1,1 )
oPrint:Textout(TRANSF(MA[I,4], "99,999.99"),.F.)
ELSE
oPrint:SetPrc(oPrint:Prow()+1,1 )
oPrint:Textout(TRANSF(MA[I,4], "99,999.99"),.F.)
ENDIF
oPrint:SetPrc(oPrint:Prow(), 11 )
oPrint:Textout( MA[I,9] ,.F.)
oPrint:SetPrc(oPrint:Prow(), 18 )
oPrint:Textout(MA[I, 2] ,.F.)
oPrint:SetPrc(oPrint:Prow(), 54 )
oPrint:Textout(Transf(MA[I, 12], "99,999.99") ,.F.)
IF MA[I,26] = "C"
oPrint:SetPrc(oPrint:Prow(), 64 )
oPrint:Textout(Transf(ROUND((( MA[I, 4] * MA[I,24] ) * MA[I,12]),2), "999,999.99") ,.F.)
ELSE
oPrint:SetPrc(oPrint:Prow(), 64 )
oPrint:Textout(Transf(ROUND( (MA[I, 4] * MA[I,12]),2) , "999,999.99") ,.F.)
NTOTAL += ROUND(( MA[I, 4] * MA[I,12] ),2)
ENDIF
oPrint:SetPrc(oPrint:Prow(), 74 )
oPrint:Textout(Transf(MA[I, 3], "999,999.99") ,.F.)
oPrint:SetPrc(oPrint:Prow(), 84 )
oPrint:Textout( MA[I, 14] ,.F.)
oPrint:SetPrc(oPrint:Prow(), 85 )
oPrint:Textout( Transf(ROUND(( MA[I, 3] * MA[I,4] ),2),"999,999.99") ,.F.)
NTOTAL2 += ROUND(( MA[I, 3] * MA[I,4] ),2)
IF MA[I, 30] ="S"
DBSELECTAR("ARTICULO")
DBSETORDER(4)
IF DBSEEK(MA[I,9])
X1 := 0
bandi:= .f.
DO WHILE ARTICULO->LIGA = MA[I,9]
* CON IVA SIN OFERTA REBANADO
if articulo->siva = "B" .and. (date() < articulo->vig1 .or. date() > vig2) .and. articulo->padre = "R"
nreba1 := ARTICULO->PRECIO*nIVA115X
bandi := .t.
endif
* CON IVA SIN OFERTA MENUDEO
if articulo->siva = "B" .and. (date() < articulo->vig1 .or. date() > vig2) .and. articulo->padre = "M"
nmenu1 := ARTICULO->PRECIO*nIVA115X
bandi := .t.
endif
* COIN IVA EN OFERTA REBANADO
if articulo->siva = "B" .and. (date() >= articulo->vig1 .and. date()<= vig2) .and. articulo->padre = "R"
nreba1 := ARTICULO->ofer_p*nIVA115X
creba := "*"
bandi := .t.
endif
* COIN IVA EN OFERTA MENUDEO
if articulo->siva = "B" .and. (date() >= articulo->vig1 .and. date()<= vig2) .and. articulo->padre = "M"
nmenu1 := ARTICULO->ofer_p*nIVA115X
bandi := .t.
cmenu := "*"
endif
* SIN IVA SIN OFERTA REBANADO
if articulo->siva = "A" .and. (date() < articulo->vig1 .or. date() > vig2) .and. articulo->padre = "R"
nreba1 := ARTICULO->PRECIO
bandi := .t.
endif
* SIN IVA SIN OFERTA MENUDEO
if articulo->siva = "A" .and. (date() < articulo->vig1 .or. date() > vig2) .and. articulo->padre = "M"
nmenu1 := ARTICULO->PRECIO
bandi := .t.
endif
* SIN IVA CON OFERTA REBANADO
if articulo->siva = "A" .and. (date() >= articulo->vig1 .and. date()<= vig2) .and. articulo->padre = "R"
nreba1 := ARTICULO->ofer_p
creba := "*"
bandi := .t.
endif
* SIN IVA CON OFERTA MENUDEO
if articulo->siva = "A" .and. (date() >= articulo->vig1 .and. date()<= vig2) .and. articulo->padre = "M"
nmenu1 := ARTICULO->ofer_p
cmenu := "*"
bandi := .t.
endif
* con iva sin oferta REBANADO
if articulo->siva = "B" .and. (date() < articulo->vig1 .or. date() > vig2) .and. articulo->padre = "R"
nreba := ARTICULO->PRECIO*nIVA115X*MA[I,4]
X11 += ARTICULO->PRECIO*nIVA115X*MA[I,4]
endif
* con iva sin oferta MENUDEO
if articulo->siva = "B" .and. (date() < articulo->vig1 .or. date() > vig2) .and. articulo->padre = "M"
nmenu := ARTICULO->PRECIO*nIVA115X*MA[I,4]
X22 += ARTICULO->PRECIO*nIVA115X*MA[I,4]
endif
* con iva en oferta REBANADO
if articulo->siva = "B" .and. (date() >= articulo->vig1 .and. date()<= vig2) .and. articulo->padre = "R"
nreba := ARTICULO->ofer_p*nIVA115X*MA[I,4]
x11 += ARTICULO->ofer_p*nIVA115X*MA[I,4]
endif
* con iva en oferta MENUDEO
if articulo->siva = "B" .and. (date() >= articulo->vig1 .and. date()<= vig2) .and. articulo->padre = "M"
nmenu := ARTICULO->ofer_p*nIVA115X*MA[I,4]
x22 += ARTICULO->ofer_p*nIVA115X*MA[I,4]
endif
* sin iva sin oferta REBANADO
if articulo->siva = "A" .and. (date() < articulo->vig1 .or. date() > vig2) .and. articulo->padre = "R"
nreba := ARTICULO->PRECIO*MA[I,4]
x11 += ARTICULO->PRECIO*MA[I,4]
endif
* sin iva sin oferta MENUDEO
if articulo->siva = "A" .and. (date() < articulo->vig1 .or. date() > vig2) .and. articulo->padre = "M"
nmenu := ARTICULO->PRECIO*MA[I,4]
x22 += ARTICULO->PRECIO*MA[I,4]
endif
* sin iva con oferta REBANADO
if articulo->siva = "A" .and. (date() >= articulo->vig1 .and. date()<= vig2) .and. articulo->padre = "R"
nreba := ARTICULO->ofer_p*MA[I,4]
x11 += ARTICULO->ofer_p*MA[I,4]
endif
* sin iva con oferta MENUDEO
if articulo->siva = "A" .and. (date() >= articulo->vig1 .and. date()<= vig2) .and. articulo->padre = "M"
nmenu:=ARTICULO->ofer_p*MA[I,4]
x22 += ARTICULO->ofer_p*MA[I,4]
endif
DBSkip()
X1 += 11
ENDDO
*IMPRESION DE PRECIOS REBANADOS Y MENUDEOS
if bandi
IF NREBA>0
oPrint:SetPrc(oPrint:Prow(), 96 )
oPrint:Textout( Transf(NREBA1,"999,999.99") ,.F.)
oPrint:SetPrc(oPrint:Prow(),106 )
oPrint:Textout(CREBA ,.F.)
oPrint:SetPrc(oPrint:Prow(),107 )
oPrint:Textout(Transf(NREBA ,"999,999.99") ,.F.)
ENDIF
NREBA := NREBA1 := NMENU := NMENU1 := 0
CREBA := CMENU := " "
BANDI := .F.
Endif
ENDIF
ENDIF
LIN++
IF LIN >= 58
oPrint:NewPage()
LIN = 0
TITULOAJUSTEWIN()
ENDIF
ENDIF
NEXT
IF LIN >= 54
oPrint:NewPage()
LIN = 0
TITULOAJUSTEWIN()
ENDIF
oPrint:SetPrc(oPrint:Prow()+1, 0 )
oPrint:Textout(REPLICATE("-",135) ,.F.)
IF !EMPTY(cCONCEP1)
oPrint:SetPrc(oPrint:Prow()+1, 0 )
oPrint:Textout(cCONCEP1 ,.F.)
ENDIF
IF !EMPTY(cCONCEP2)
oPrint:SetPrc(oPrint:Prow()+1, 0 )
oPrint:Textout(cCONCEP2 ,.F.)
ENDIF
IF !EMPTY(cCONCEP3)
oPrint:SetPrc(oPrint:Prow()+1, 0 )
oPrint:Textout(cCONCEP3 ,.F.)
ENDIF
oPrint:SetPrc(oPrint:Prow()+1, 45 )
oPrint:Textout("TOTALES: " ,.F.)
oPrint:SetPrc(oPrint:Prow(), 63+1 )
oPrint:Textout(Transf(nTotal,"999,999.99") ,.F.)
oPrint:SetPrc(oPrint:Prow(), 84+1 )
oPrint:Textout(Transf(nTotal2,"999,999.99") ,.F.)
if x11 >0
oPrint:SetPrc(oPrint:Prow(),106+1 )
oPrint:Textout(Transf(X11, "999,999.99") ,.F.)
endif
if x22 >0
oPrint:SetPrc(oPrint:Prow(), 128+1 )
oPrint:Textout(Transf(X22, "999,999.99") ,.F.)
endif
oPrint:SetPrc(oPrint:Prow()+3, 5 )
oPrint:Textout(" CAPTURO AJUSTE " ,.F.)
oPrint:SetPrc(oPrint:Prow()+1, 11 )
oPrint:Textout(ANOMUSU ,.F.)
oPrint:SetPrc(oPrint:Prow()+2, 5 )
oPrint:Textout("---------------------------" ,.F.)
oPrint:SetPrc(oPrint:Prow()+1, 5 )
oPrint:Textout(" FIRMA Y NOMBRE " ,.F.)
oPrint:EndDoc(.F.)
oPrint:Destroy()
RETURN
//---------------------
PROCEDURE TITULOAJUSTEWIN()
IF LIN = 0
oPrint:SetPrc(0, 0)
oPrint:SetPrc(oPrint:Prow()+1,(INT(135-LEN(cNOM_EMP))/2) )
oPrint:Textout(cNOM_EMP,.F.)
oPrint:SetPrc(oPrint:Prow()+1,(INT(135-LEN("SUC : " + cSUC_EMP))/2) )
oPrint:Textout(cSUC_EMP,.F.)
oPrint:SetPrc(oPrint:Prow()+1,(INT(135-LEN("COMPROBANTE DE MOVIMIENTOS"))/2) )
oPrint:Textout("COMPROBANTE DE MOVIMIENTOS",.F.)
oPrint:SetPrc(oPrint:Prow()+1,0 )
oPrint:Textout("FECHA : " + DTOC(DATE()) +" - "+TIME() + " " +"FOLIO: " + cFOLIO,.F.)
oPrint:SetPrc(oPrint:Prow()+1,0 )
oPrint:Textout(REPLICATE("-",135),.F.)
oPrint:SetPrc(oPrint:Prow()+1,0 )
oPrint:Textout("MOV. :" + cCONCEP +" "+cDESCRIP,.F.)
oPrint:SetPrc(oPrint:Prow()+1,0 )
oPrint:Textout("CLTE/PROV : "+ cPROV+" "+cDESCPROV,.F.)
oPrint:SetPrc(oPrint:Prow()+1,0 )
oPrint:Textout(REPLICATE("-",135),.F.)
oPrint:SetPrc(oPrint:Prow()+1,0 )
oPrint:Textout("CANTIDAD CODIGO",.F.)
oPrint:SetPrc(oPrint:Prow(), 18 )
oPrint:Textout("D E S C R I P C I O N",.F.)
oPrint:SetPrc(oPrint:Prow(), 54 )
oPrint:Textout("COSTO",.F.)
oPrint:SetPrc(oPrint:Prow(), 64+2 )
oPrint:Textout("T O T A L",.F.)
oPrint:SetPrc(oPrint:Prow(), 74+2 )
oPrint:Textout("PRECIO 1",.F.)
oPrint:SetPrc(oPrint:Prow(), 85+2 )
oPrint:Textout("TOTAL P1",.F.)
oPrint:SetPrc(oPrint:Prow(), 96+2 )
oPrint:Textout("PRECIO 2",.F.)
oPrint:SetPrc(oPrint:Prow(),107+2 )
oPrint:Textout("TOTAL P2",.F.)
oPrint:SetPrc(oPrint:Prow()+1, 0 )
oPrint:Textout(REPLICATE("-",135),.F.)
LIN = 10
ENDIF
RETURN