manual de Programacion.docx
-
Upload
wilmerpelicosontay -
Category
Documents
-
view
218 -
download
0
Transcript of manual de Programacion.docx
-
8/17/2019 manual de Programacion.docx
1/42
-
8/17/2019 manual de Programacion.docx
2/42
8ar Itype
8ar Iphpin J array(4:9:0) // iniu 8ersion o" 5&5 reEuired ,y odule 8ar I8ersion J Fdoli,arrF
8ar Ipagelargeur 8ar Ipagehauteur 8ar I"orat
8ar Iargegau!he8ar Iargedroite8ar Iargehaute8ar Iarge,asse
8ar Ieetteur // =,.et so!iete Eui eet
/** * Constru!tor * * @para DoliD+ Id, Data,ase handler */"un!tion !onstru!t(Id,)H
glo,al I!on":Ilangs:Iyso!
Ilangs-#load(KainK)Ilangs-#load(K,illsK)
Ithis-#d, J Id,Ithis-#nae J Ki6a!turaKIthis-#des!ription J Ilangs-#trans(F5D6Cra,eDes!riptionF)
// Diension page pour "orat >4Ithis-#type J Fpd"FI"oratarrayJpd"get6orat()Ithis-#pagelargeur J I"oratarrayF'idthFMIthis-#pagehauteur J I"oratarrayFheightFMIthis-#"orat J array(Ithis-#pagelargeur:Ithis-#pagehauteur)Ithis-#argegau!heJisset(I!on"-#glo,al-
#>35D6>%3L6)?I!on"-#glo,al-#>35D6>%3L6A10Ithis-#argedroiteJisset(I!on"-#glo,al-
#>35D6>%3%&)?I!on"-#glo,al-#>35D6>%3%&A10Ithis-#argehaute Jisset(I!on"-#glo,al-
#>35D6>%3=5)?I!on"-#glo,al-#>35D6>%3=5A10Ithis-#arge,asse Jisset(I!on"-#glo,al-
#>35D6>%3+==)?I!on"-#glo,al-#>35D6>%3+==A10
-
8/17/2019 manual de Programacion.docx
3/42
Ithis-#optionlogo J 1 // >N!he logoIthis-#optiont8a J 1 // ere option t8a
6>C%O>=5=3Ithis-#optionodereg J 1 // >N!he ode regleentIthis-#option!ondreg J 1 // >N!he !onditions
regleentIthis-#option!odeproduitser8i!e J 1 // >N!he !ode produit-
ser8i!eIthis-#optionultilang J 1 // Dispo en plusieurs languesIthis-#optiones!opte J 1 // >N!he si il y a eu
es!opteIthis-#option!reditnote J 1 // 7upport !redit notesIthis-#option"reeteGt J 1 // 7upport
add o" a personalised teGtIthis-#optiondra"t'aterar J 1 // 7upport add o" a
'aterar on dra"ts
Ithis-#"ran!hiseJPIyso!-#t8aassu.
// et sour!e !opanyIthis-#eetteurJIyso!i" (epty(Ithis-#eetteur-#!ountry!ode)) Ithis-#eetteur-
#!ountry!odeJsu,str(Ilangs-#de"aultlang:-2) // +y de"ault: i" 'as notdened
// Dene position o" !olunsIthis-#posGdes!JIthis-#argegau!heQ1Ithis-#posGt8aJ112Ithis-#posGupJ12RIthis-#posGEtyJ14$Ithis-#posGdis!ountJ1R2Ithis-#postotalhtJ1S4i" (P epty(I!on"-#glo,al-
#>33%>D=C37;&=O>)) Ithis-#posGt8aJIthis-#posGup
Ithis-#posGpi!tureJIthis-#posGt8a - (epty(I!on"-#glo,al-#>3D=C37;&5C%;D&)?20AI!on"-#glo,al-#>3D=C37;&5C%;D&) // 'idth o" iages
i" (Ithis-#pagelargeur < 210) // o 'or 'ith 7 eGe!uti8e "oratH
Ithis-#posGpi!ture-J20Ithis-#posGt8a-J20Ithis-#posGup-J20Ithis-#posGEty-J20Ithis-#posGdis!ount-J20Ithis-#postotalht-J20
-
8/17/2019 manual de Programacion.docx
4/42
T
Ithis-#t8aJarray()Ithis-#lo!altaG1Jarray()Ithis-#lo!altaG2Jarray()Ithis-#atleastoneratenotnullJ0Ithis-#atleastonedis!ountJ0
T
/** * 6un!tion to ,uild pd" onto dis * * @para =,.e!t Io,.e!t
=,.e!t to generate * @para ranslate Ioutputlangs Lang outputo,.e!t * @para string Isr!teplatepath 6ull path o" sour!elenae "or generator using a teplate le * @para int Ihidedetails Do not sho'line details * @para int Ihidedes! Do notsho' des! * @para int Ihidere" Do notsho' re" * @return int 1J=U: 0JU=
*/"un!tion 'ritele(Io,.e!t:Ioutputlangs:Isr!teplatepathJFF:
IhidedetailsJ0:Ihidedes!J0:Ihidere"J0)H
glo,al Iuser:Ilangs:I!on":Iyso!:Id,:Ihooanager
i" (P iso,.e!t(Ioutputlangs)) IoutputlangsJIlangs// 6or ,a!'ard !opati,ility 'ith 65D6: "or!e output !harset to
7=: ,e!ause 65D6 eGpe!t teGt to ,e en!oded in 7=i" (P epty(I!on"-#glo,al-#>3765D6)) Ioutputlangs-
#!harsetoutputJF7=-$V-1F
Ioutputlangs-#load(KainK)
Ioutputlangs-#load(Kdi!tK)Ioutputlangs-#load(K!opaniesK)Ioutputlangs-#load(K,illsK)Ioutputlangs-#load(Kprodu!tsK)
In,lignes J !ount(Io,.e!t-#lines)
-
8/17/2019 manual de Programacion.docx
5/42
// Loop on ea!h lines to dete!t i" there is at least one iage tosho'
IrealpatharrayJarray()i" (P epty(I!on"-#glo,al-
#>33%>3O=C7;&5C%))H
"or (Ii J 0 Ii < In,lignes IiQQ)H
i" (epty(Io,.e!t-#linesIiM-#"produ!t)) !ontinue
Io,.photo J ne' 5rodu!t(Ithis-#d,)Io,.photo-#"et!h(Io,.e!t-#linesIiM-#"produ!t)
Ipdir J geteGdir(Io,.e!t-#linesIiM-#"produ!t:2) Io,.e!t-#linesIiM-#"produ!t K/photos/K
Idir J I!on"-#produ!t-#diroutputF/FIpdir
IrealpathJFF"orea!h (Io,.photo-#listephotos(Idir:1) as Iey J#
Io,.)H
IlenaeJIo,.FphotoFM//i" (Io,.Fphoto8ignetteFM)
IlenaeJFthu,s/FIo,.Fphoto8ignetteFMIrealpath J IdirIlenae,rea
T
i" (Irealpath) IrealpatharrayIiMJIrealpathT
Ti" (!ount(Irealpatharray) JJ 0) Ithis-#posGpi!tureJIthis-
#posGt8a
i" (I!on"-#"a!ture-#diroutput)H
Io,.e!t-#"et!hthirdparty()
Ide.aregle J Io,.e!t-#get7oe5aieent()
Iaount!reditnotesin!luded J Io,.e!t-#get7uCredit3otessed()
Iaountdepositsin!luded J Io,.e!t-#get7uDepositssed()
// Denition o" Idir and Ilei" (Io,.e!t-#spe!ien)H
-
8/17/2019 manual de Programacion.docx
6/42
Idir J I!on"-#"a!ture-#diroutputIle J Idir K/75C3pd"K
TelseH
Io,.e!tre" J dolsanitiWe6ile3ae(Io,.e!t-#re")Idir J I!on"-#"a!ture-#diroutput K/K Io,.e!tre"Ile J Idir K/K Io,.e!tre" Kpd"K
Ti" (P leeGists(Idir))H
i" (doldir(Idir) < 0)H
Ithis-#errorJIlangs-#transnoentities(KrrorCan3otCreateDirK:Idir)
return 0T
T
i" (leeGists(Idir))H
// >dd pd"generation hooi" (P iso,.e!t(Ihooanager))H
in!ludeon!eD=LD=C3%==F/!ore/!lass/hooanager!lassphpF
IhooanagerJne' &ooanager(Ithis-#d,)TIhooanager-#init&oos(array(Fpd"generationF))
IparaetersJarray(FleFJ#Ile:Fo,.e!tFJ#Io,.e!t:FoutputlangsFJ#Ioutputlangs)
glo,al Ia!tionIreshooJIhooanager-
#eGe!ute&oos(F,e"ore5D6CreationF:Iparaeters:Io,.e!t:Ia!tion) // 3otethat Ia!tion and Io,.e!t ay ha8e ,een odied ,y soe hoos
// Create pd" instan!e
Ipd"Jpd"getnstan!e(Ithis-#"orat) Ide"ault"ontsiWe J pd"get5D66ont7iWe(Ioutputlangs) // ust,e a"ter pd"getnstan!e
Iheight"orin"otot J $0 // &eight reser8ed to outputthe in"o and total part
Iheight"or"reeteGtJ (isset(I!on"-#glo,al-#>35D66%X&&)?I!on"-#glo,al-
-
8/17/2019 manual de Programacion.docx
7/42
#>35D66%X&&A$) // &eight reser8ed to output the "ree teGton last page
Iheight"or"ooter J Ithis-#arge,asse Q // &eightreser8ed to output the "ooter (8alue in!lude ,otto argin) Ipd"-#7et>uto5age+rea(1:0)
i" (!lasseGists(FC5D6F)) H Ipd"-#set5rint&eader("alse) Ipd"-#set5rint6ooter("alse) T Ipd"-#7et6ont(pd"get5D66ont(Ioutputlangs))
// 7et path to the ,a!ground 5D6 6ile i" (epty(I!on"-#glo,al-#>3D7>+L65D) YY P epty(I!on"-#glo,al-#>3>DD5D6+>CU%=3D)) H
Ipage!ount J Ipd"-#set7our!e6ile(I!on"-#y!opany-#diroutputF/FI!on"-#glo,al-#>3>DD5D6+>CU%=3D)
ItplidG J Ipd"-#iport5age(1) T
Ipd"-#=pen()Ipagen,J0Ipd"-#7etDra'Color(12:12:12)
Ipd"-#7etitle(Ioutputlangs-#!on8o=utputCharset(Io,.e!t-#re"))
Ipd"-#7et7u,.e!t(Ioutputlangs-#transnoentities(Kn8oi!eK))
Ipd"-#7etCreator(KDoli,arr KD=LO%7=3)Ipd"-#7et>uthor(Ioutputlangs-
#!on8o=utputCharset(Iuser-#get6ull3ae(Ioutputlangs)))Ipd"-#7etUey;ords(Ioutputlangs-
#!on8o=utputCharset(Io,.e!t-#re")K KIoutputlangs-#transnoentities(Kn8oi!eK))
i" (P epty(I!on"-#glo,al-#>3D7>+L5D6C=5%77=3)) Ipd"-#7etCopression("alse)
Ipd"-#7etargins(Ithis-#argegau!he: Ithis-#argehaute: Ithis-#argedroite) // Le"t: op: %ight
// 5ositionne Ithis-#atleastonedis!ount si on a auoins une reise
"or (Ii J 0 Ii < In,lignes IiQQ)H
i" (Io,.e!t-#linesIiM-#reiseper!ent)
-
8/17/2019 manual de Programacion.docx
8/42
HIthis-#atleastonedis!ountQQ
TTi" (epty(Ithis-#atleastonedis!ount))H
Ithis-#posGpi!tureQJ(Ithis-#postotalht -Ithis-#posGdis!ount)
Ithis-#posGt8aQJ(Ithis-#postotalht - Ithis-#posGdis!ount)
Ithis-#posGupQJ(Ithis-#postotalht - Ithis-#posGdis!ount)
Ithis-#posGEtyQJ(Ithis-#postotalht - Ithis-#posGdis!ount)
Ithis-#posGdis!ountQJ(Ithis-#postotalht -Ithis-#posGdis!ount)
//Ithis-#postotalhtT
// 3e' pageIpd"-#>dd5age()i" (P epty(ItplidG)) Ipd"-#useeplate(ItplidG)Ipagen,QQ
Ithis-#pagehead(Ipd": Io,.e!t: 1: Ioutputlangs)Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1)Ipd"-#ultiCell(0: 9: FF) // 7et interline to 9Ipd"-#7eteGtColor(0:0:0)
Ita,top J V0Ita,topne'page J (epty(I!on"-#glo,al-
#>35D6D=3=%5>&>D)?42A10)Ita,height J 190Ita,heightne'page J 1$0
// >N!he notesInotetosho'Jepty(Io,.e!t-#notepu,li!)?FFA
Io,.e!t-#notepu,li!i" (P epty(I!on"-#glo,al-
#>3>DD7>L%573>%33=))H
// et rst sale repi" (iso,.e!t(Io,.e!t-#thirdparty))H
IsalereparrayJIo,.e!t-#thirdparty-#get7ales%epresentati8es(Iuser)
Isalerepo,.Jne' ser(Ithis-#d,)
-
8/17/2019 manual de Programacion.docx
9/42
Isalerepo,.-#"et!h(Isalereparray0MFidFM)
i" (P epty(Isalerepo,.-#signature))Inotetosho'Jdol!on!atdes!(Inotetosho': Isalerepo,.-#signature)
TTi" (Inotetosho')H
Ita,top J
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1)Ipd"-#'rite&LCell(1V0: 9: Ithis-#posGdes!-
1: Ita,top: dolhtlentities,r(Inotetosho'): 0: 1)IneG J Ipd"-#et()IheightnoteJIneG-Ita,top
// %e!t prend une longueur en 9ee paraIpd"-#7etDra'Color(1V2:1V2:1V2)Ipd"-#%e!t(Ithis-#argegau!he: Ita,top-1:
Ithis-#pagelargeur-Ithis-#argegau!he-Ithis-#argedroite:IheightnoteQ1)
Ita,height J Ita,height - IheightnoteIta,top J IneGQR
TelseH
IheightnoteJ0T
Iini J Ita,top Q SI!ur J Ita,top Q SIneG J Ita,top Q S
// Loop on ea!h lines"or (Ii J 0 Ii < In,lignes IiQQ)H
I!ur J IneGIpd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1) //
nto loop to 'or 'ith ultipageIpd"-#7eteGtColor(0:0:0)
// Dene siWe o" iage i" 'e need itIiglinesiWeJarray()i" (P epty(IrealpatharrayIiM))
IiglinesiWeJpd"get7iWe6orage(IrealpatharrayIiM)
-
8/17/2019 manual de Programacion.docx
10/42
Ipd"-#setopargin(Ita,topne'page)Ipd"-#set5age=rientation(FF: 1:
Iheight"or"ooterQIheight"or"reeteGtQIheight"orin"otot) // he only "un!tion toedit the ,otto argin o" !urrent page to set it
Ipagepos,e"oreJIpd"-#get5age()
Isho'pri!e,e"orepage,reaJ1Ipos>"terageJ0Ipos>"terDes!riptionJ0
// ;e start 'ith 5hoto o" produ!t linei" (isset(IiglinesiWeF'idthFM) YY
isset(IiglinesiWeFheightFM) YY (I!ur Q IiglinesiWeFheightFM) # (Ithis-#pagehauteur-(Iheight"or"ooterQIheight"or"reeteGtQIheight"orin"otot))) //" photo too high: 'e o8ed !opletely on ne' page
HIpd"-#>dd5age(FF:FF:true)i" (P epty(ItplidG)) Ipd"-
#useeplate(ItplidG)i" (epty(I!on"-#glo,al-
#>35D6D=3=%5>&>D)) Ithis-#pagehead(Ipd": Io,.e!t: 0:Ioutputlangs)
Ipd"-#set5age(Ipagepos,e"oreQ1)
I!ur J Ita,topne'pageIsho'pri!e,e"orepage,reaJ0
T
i" (isset(IiglinesiWeF'idthFM) YYisset(IiglinesiWeFheightFM))
HI!urX J Ithis-#posGpi!ture-1Ipd"-#age(IrealpatharrayIiM: I!urX Q
((Ithis-#posGt8a-Ithis-#posGpi!ture-IiglinesiWeF'idthFM)/2): I!ur:IiglinesiWeF'idthFM: IiglinesiWeFheightFM: FF: FF: FF: 2: 900) // se 900 dpi
// Ipd"-#age does not in!rease 8aluereturn ,y get: so 'e sa8e it anually
Ipos>"terageJI!urQIiglinesiWeFheightFM
T
// Des!ription o" produ!t lineI!urX J Ithis-#posGdes!-1
Ipd"-#startransa!tion()pd"'ritelinedes!(Ipd":Io,.e!t:Ii:Ioutputlangs:
Ithis-#posGpi!ture-I!urX:9:I!urX:I!ur:Ihidere":Ihidedes!)
-
8/17/2019 manual de Programacion.docx
11/42
Ipageposa"terJIpd"-#get5age()i" (Ipageposa"ter # Ipagepos,e"ore) // here
is a page,reaH
Ipd"-#roll,a!ransa!tion(true)Ipageposa"terJIpagepos,e"ore//print Ipageposa"terF-F
Ipagepos,e"oreeGitIpd"-#set5age=rientation(FF: 1:
Iheight"or"ooter) // he only "un!tion to edit the ,otto argin o" !urrentpage to set it
pd"'ritelinedes!(Ipd":Io,.e!t:Ii:Ioutputlangs:Ithis-#posGpi!ture-I!urX:9:I!urX:I!ur:Ihidere":Ihidedes!)
Ipageposa"terJIpd"-#get5age()Iposya"terJIpd"-#et()//8ardup(Iposya"ter)
8ardup((Ithis-#pagehauteur - (Iheight"or"ooterQIheight"or"reeteGtQIheight"orin"otot))) eGit
i" (Iposya"ter # (Ithis-#pagehauteur -(Iheight"or"ooterQIheight"or"reeteGtQIheight"orin"otot))) // here is nospa!e le"t "or totalQ"ree teGt
Hi" (Ii JJ (In,lignes-1)) // 3o
ore lines: and no spa!e le"t to sho' total: so 'e !reate a ne' pageH
Ipd"-#>dd5age(FF:FF:true)i" (P epty(ItplidG)) Ipd"-
#useeplate(ItplidG)i" (epty(I!on"-#glo,al-
#>35D6D=3=%5>&>D)) Ithis-#pagehead(Ipd": Io,.e!t: 0:Ioutputlangs)
Ipd"-#set5age(Ipageposa"terQ1)
TTelseH
// ;e "ound a page ,reaIsho'pri!e,e"orepage,reaJ0
TTelse // 3o page,reaH
Ipd"-#!oitransa!tion()TIpos>"terDes!riptionJIpd"-#et()
-
8/17/2019 manual de Programacion.docx
12/42
IneG J Ipd"-#et()Ipageposa"terJIpd"-#get5age()Ipd"-#set5age(Ipagepos,e"ore)Ipd"-#setopargin(Ithis-#argehaute)Ipd"-#set5age=rientation(FF: 1: 0) // he
only "un!tion to edit the ,otto argin o" !urrent page to set it
// ;e suppose that a too long des!ription orphoto 'ere o8ed !opletely on neGt page
i" (Ipageposa"ter # Ipagepos,e"ore YYepty(Isho'pri!e,e"orepage,rea)) H
Ipd"-#set5age(Ipageposa"ter) I!ur JIta,topne'page
T
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1) //=n repositionne la poli!e par de"aut
// O> %atei" (epty(I!on"-#glo,al-
#>33%>D=C37;&=O>))H
I8atrate J pd"getline8atrate(Io,.e!t:Ii: Ioutputlangs: Ihidedetails)
Ipd"-#7etX(Ithis-#posGt8a: I!ur)Ipd"-#ultiCell(Ithis-#posGup-Ithis-
#posGt8a-0: 9: I8atrate: 0: F%F)T
// nit pri!e ,e"ore dis!ountIupeG!ltaG J pd"getlineupeG!ltaG(Io,.e!t:
Ii: Ioutputlangs: Ihidedetails)Ipd"-#7etX(Ithis-#posGup: I!ur)Ipd"-#ultiCell(Ithis-#posGEty-Ithis-#posGup-
0: 9: IupeG!ltaG: 0: F%F: 0)
// ZuantityIEty J pd"getlineEty(Io,.e!t: Ii:
Ioutputlangs: Ihidedetails)
Ipd"-#7etX(Ithis-#posGEty: I!ur)Ipd"-#ultiCell(Ithis-#posGdis!ount-Ithis-
#posGEty-0: 9: IEty: 0: F%F) // nough "or R !hars
// Dis!ount on linei" (Io,.e!t-#linesIiM-#reiseper!ent)H
Ipd"-#7etX(Ithis-#posGdis!ount-2: I!ur)
-
8/17/2019 manual de Programacion.docx
13/42
Ireiseper!ent Jpd"getlinereiseper!ent(Io,.e!t: Ii: Ioutputlangs: Ihidedetails)
Ipd"-#ultiCell(Ithis-#postotalht-Ithis-#posGdis!ountQ2: 9: Ireiseper!ent: 0: F%F)
T
// otal & lineItotaleG!ltaG J
pd"getlinetotaleG!ltaG(Io,.e!t: Ii: Ioutputlangs: Ihidedetails)Ipd"-#7etX(Ithis-#postotalht: I!ur)Ipd"-#ultiCell(Ithis-#pagelargeur-Ithis-
#argedroite-Ithis-#postotalht: 9: ItotaleG!ltaG: 0: F%F: 0)
// Colle!te des totauG par 8aleur de t8a dansIthis-#t8aKtauGKMJtotalt8a
It8aligneJIo,.e!t-#linesIiM-#totalt8aIlo!altaG1ligneJIo,.e!t-#linesIiM-
#totallo!altaG1Ilo!altaG2ligneJIo,.e!t-#linesIiM-
#totallo!altaG2Ilo!altaG1rateJIo,.e!t-#linesIiM-
#lo!altaG1tGIlo!altaG2rateJIo,.e!t-#linesIiM-
#lo!altaG2tGIlo!altaG1typeJIo,.e!t-#linesIiM-
#lo!altaG1typeIlo!altaG2typeJIo,.e!t-#linesIiM-
#lo!altaG2type
i" (Io,.e!t-#reiseper!ent) It8aligne-J(It8aligne*Io,.e!t-#reiseper!ent)/100
i" (Io,.e!t-#reiseper!ent) Ilo!altaG1ligne-J(Ilo!altaG1ligne*Io,.e!t-#reiseper!ent)/100
i" (Io,.e!t-#reiseper!ent) Ilo!altaG2ligne-J(Ilo!altaG2ligne*Io,.e!t-#reiseper!ent)/100
I8atrateJ(string) Io,.e!t-#linesIiM-#t8atG
// %etrie8e type "ro data,ase "or ,a!'ard
!opati,ility 'ith old re!ordsi" ((P isset(Ilo!altaG1type) [[
Ilo!altaG1typeJJFF [[ P isset(Ilo!altaG2type) [[ Ilo!altaG2typeJJFF) // i" taGtype not dened
YY (P epty(Ilo!altaG1rate) [[ Pepty(Ilo!altaG2rate))) // and there is lo!al taG
H
-
8/17/2019 manual de Programacion.docx
14/42
Ilo!altaGtparrayJgetLo!alaGes6ro%ate(I8atrate:0: Io,.e!t-#thirdparty: Iyso!)
Ilo!altaG1type J Ilo!altaGtparray0MIlo!altaG2type J Ilo!altaGtparray2M
T
// retrie8e glo,al lo!al taGi" (Ilo!altaG1type YY Ilo!altaG1ligne PJ 0)
Ithis-#lo!altaG1Ilo!altaG1typeMIlo!altaG1rateMQJIlo!altaG1ligne
i" (Ilo!altaG2type YY Ilo!altaG2ligne PJ 0)Ithis-#lo!altaG2Ilo!altaG2typeM
Ilo!altaG2rateMQJIlo!altaG2ligne
i" ((Io,.e!t-#linesIiM-#in"o,its Y 0G01) JJ0G01) I8atrateJF*F
i" (P isset(Ithis-#t8aI8atrateM))Ithis-#t8aI8atrateMJFF
Ithis-#t8aI8atrateM QJ It8aligne
i" (Ipos>"terage # Ipos>"terDes!ription)IneGJIpos>"terage
// >dd linei" (P epty(I!on"-#glo,al-
#>35D6D>7&+;3L37) YY Ii < (In,lignes - 1))H
Ipd"-#set5age(Ipageposa"ter)Ipd"-
#7etLine7tyle(array(FdashFJ#F1:1F:F!olorFJ#array(210:210:210)))//Ipd"-#7etDra'Color(1V0:1V0:200)Ipd"-#line(Ithis-#argegau!he:
IneGQ1: Ithis-#pagelargeur - Ithis-#argedroite: IneGQ1)Ipd"-#7etLine7tyle(array(FdashFJ#0))
T
IneGQJ2 // 5asse espa!e entre les lignes
// Dete!t i" soe page 'ere added
autoati!ally and output ta,leau "or past pages'hile (Ipagen, < Ipageposa"ter)H
Ipd"-#set5age(Ipagen,)i" (Ipagen, JJ 1)H
Ithis-#ta,leau(Ipd": Ita,top:Ithis-#pagehauteur - Ita,top - Iheight"or"ooter: 0: Ioutputlangs: 0: 1)
-
8/17/2019 manual de Programacion.docx
15/42
TelseH
Ithis-#ta,leau(Ipd":Ita,topne'page: Ithis-#pagehauteur - Ita,topne'page -Iheight"or"ooter: 0: Ioutputlangs: 1: 1)
TIthis-#page"oot(Ipd":Io,.e!t:
Ioutputlangs:1)Ipagen,QQIpd"-#set5age(Ipagen,)Ipd"-#set5age=rientation(FF: 1: 0) //
he only "un!tion to edit the ,otto argin o" !urrent page to set iti" (epty(I!on"-#glo,al-
#>35D6D=3=%5>&>D)) Ithis-#pagehead(Ipd": Io,.e!t: 0:Ioutputlangs)
Ti" (isset(Io,.e!t-#linesIiQ1M-#page,rea) YY
Io,.e!t-#linesIiQ1M-#page,rea)H
i" (Ipagen, JJ 1)H
Ithis-#ta,leau(Ipd": Ita,top:Ithis-#pagehauteur - Ita,top - Iheight"or"ooter: 0: Ioutputlangs: 0: 1)
TelseH
Ithis-#ta,leau(Ipd":Ita,topne'page: Ithis-#pagehauteur - Ita,topne'page -Iheight"or"ooter: 0: Ioutputlangs: 1: 1)
TIthis-#page"oot(Ipd":Io,.e!t:
Ioutputlangs:1)// 3e' pageIpd"-#>dd5age()i" (P epty(ItplidG)) Ipd"-
#useeplate(ItplidG)Ipagen,QQi" (epty(I!on"-#glo,al-
#>35D6D=3=%5>&>D)) Ithis-#pagehead(Ipd": Io,.e!t: 0:Ioutputlangs)
TT
// 7ho' sEuarei" (Ipagen, JJ 1)H
-
8/17/2019 manual de Programacion.docx
16/42
Ithis-#ta,leau(Ipd": Ita,top: Ithis-#pagehauteur - Ita,top - Iheight"orin"otot - Iheight"or"reeteGt -Iheight"or"ooter: 0: Ioutputlangs: 0: 0)
I,ottolastta,JIthis-#pagehauteur -Iheight"orin"otot - Iheight"or"reeteGt - Iheight"or"ooter Q 1
TelseH
Ithis-#ta,leau(Ipd": Ita,topne'page:Ithis-#pagehauteur - Ita,topne'page - Iheight"orin"otot -Iheight"or"reeteGt - Iheight"or"ooter: 0: Ioutputlangs: 1: 0)
I,ottolastta,JIthis-#pagehauteur -Iheight"orin"otot - Iheight"or"reeteGt - Iheight"or"ooter Q 1
T
// >N!he Wone in"osIposyJIthis-#ta,leauin"o(Ipd": Io,.e!t:
I,ottolastta,: Ioutputlangs)
// >N!he Wone totauGIposyJIthis-#ta,leautot(Ipd": Io,.e!t:
Ide.aregle: I,ottolastta,: Ioutputlangs)
// >N!he Wone 8erseentsi" (Ide.aregle [[ Iaount!reditnotesin!luded [[
Iaountdepositsin!luded)H
IposyJIthis-#ta,leau8erseents(Ipd":Io,.e!t: Iposy: Ioutputlangs)
T
// 5ied de pageIthis-#page"oot(Ipd":Io,.e!t:Ioutputlangs)i" (ethodeGists(Ipd":F>lias3,5agesF)) Ipd"-
#>lias3,5ages()
Ipd"-#Close()
Ipd"-#=utput(Ile:F6F)
// >dd pd"generation hooIhooanager-#init&oos(array(Fpd"generationF))
IparaetersJarray(FleFJ#Ile:Fo,.e!tFJ#Io,.e!t:FoutputlangsFJ#Ioutputlangs)
glo,al Ia!tion
-
8/17/2019 manual de Programacion.docx
17/42
IreshooJIhooanager-#eGe!ute&oos(Fa"ter5D6CreationF:Iparaeters:Ithis:Ia!tion) // 3ote thatIa!tion and Io,.e!t ay ha8e ,een odied ,y soe hoos
i" (P epty(I!on"-#glo,al-#>3>7U))@!hod(Ile: o!tde!(I!on"-#glo,al-#>3>7U))
return 1 // 5as dFerreurTelseH
Ithis-#errorJIlangs-#trans(KrrorCan3otCreateDirK:Idir)
return 0T
TelseH
Ithis-#errorJIlangs-#trans(KrrorConstant3otDenedK:K6>C=5D%K)
return 0TIthis-#errorJIlangs-#trans(Krrornno'nK)return 0 // rreur par de"aut
T
/** * 7ho' payents ta,le *
* @para 5D6 Ipd" =,.e!t 5D6 * @para =,.e!t Io,.e!t =,.e!t in8oi!e * @para int Iposy 5osition y in 5D6 * @para ranslate Ioutputlangs =,.e!t langs "or output * @return int
-
8/17/2019 manual de Programacion.docx
18/42
Ita,9height J 4i" (Ithis-#pagelargeur < 210) // o 'or 'ith 7 eGe!uti8e "oratH
Ita,9posG -J 20T
Ide"ault"ontsiWe J pd"get5D66ont7iWe(Ioutputlangs)
ItitleJIoutputlangs-#transnoentities(K5ayents>lreadyDoneK)i" (Io,.e!t-#type JJ 2) ItitleJIoutputlangs-
#transnoentities(K5ayents+a!>lreadyDoneK)
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 9)Ipd"-#7etX(Ita,9posG: Ita,9top - 4)Ipd"-#ultiCell(R0: 9: Ititle: 0: FLF: 0)
Ipd"-#line(Ita,9posG: Ita,9top: Ita,9posGQIta,9'idth:Ita,9top)
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 4)Ipd"-#7etX(Ita,9posG: Ita,9top)Ipd"-#ultiCell(20: 9: Ioutputlangs-#transnoentities(K5ayentK):
0: FLF: 0)Ipd"-#7etX(Ita,9posGQ21: Ita,9top)Ipd"-#ultiCell(20: 9: Ioutputlangs-#transnoentities(K>ountK):
0: FLF: 0)Ipd"-#7etX(Ita,9posGQ40: Ita,9top)Ipd"-#ultiCell(20: 9: Ioutputlangs-#transnoentities(KypeK): 0:
FLF: 0)Ipd"-#7etX(Ita,9posGQ$: Ita,9top)Ipd"-#ultiCell(20: 9: Ioutputlangs-#transnoentities(K3uK): 0:
FLF: 0)
Ipd"-#line(Ita,9posG: Ita,9top-1QIta,9height: Ita,9posGQIta,9'idth: Ita,9top-1QIta,9height)
IyJ0
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 4)
// Loop on ea!h deposits and !redit notes in!ludedIsEl J K7LC rero'id: reaountht: reaountt8a:
reaounttt!:KIsElJ K redes!ription: re""a!turesour!e:KIsElJ K "type: "date"KIsElJ K 6%= K>3D+5%6X Kso!ietereiseeG!ept as re:
K>3D+5%6X K"a!ture as "K
-
8/17/2019 manual de Programacion.docx
19/42
IsElJ K ;&% re""a!turesour!e J "ro'id >3D re""a!ture JKIo,.e!t-#id
IresElJIthis-#d,-#Euery(IsEl)i" (IresEl)H
Inu J Ithis-#d,-#nuro's(IresEl)IiJ0Iin8oi!eJne' 6a!ture(Ithis-#d,)'hile (Ii < Inu)H
IyQJ9Io,. J Ithis-#d,-#"et!ho,.e!t(IresEl)
i" (Io,.-#type JJ 2) IteGtJIoutputlangs-#trans(KCredit3oteK)
elsei" (Io,.-#type JJ 9) IteGtJIoutputlangs-#trans(KDepositK)
else IteGtJIoutputlangs-#trans(Knno'nypeK)
Iin8oi!e-#"et!h(Io,.-#""a!turesour!e)
Ipd"-#7etX(Ita,9posG: Ita,9topQIy)Ipd"-#ultiCell(20: 9: dolprintdate(Io,.-
#date":FdayF:"alse:Ioutputlangs:true): 0: FLF: 0)Ipd"-#7etX(Ita,9posGQ21: Ita,9topQIy)Ipd"-#ultiCell(20: 9: pri!e(Io,.-#aounttt!: 0:
Ioutputlangs): 0: FLF: 0)Ipd"-#7etX(Ita,9posGQ40: Ita,9topQIy)Ipd"-#ultiCell(20: 9: IteGt: 0: FLF: 0)Ipd"-#7etX(Ita,9posGQ$: Ita,9topQIy)Ipd"-#ultiCell(20: 9: Iin8oi!e-#re": 0: FLF: 0)
Ipd"-#line(Ita,9posG: Ita,9topQIyQ9:Ita,9posGQIta,9'idth: Ita,9topQIyQ9)
IiQQT
Telse
HIthis-#errorJIthis-#d,-#lasterror()return -1
T
// Loop on ea!h payentIsEl J K7LC pdatep as date: p"paieent as type:
pnupaieent as nu: p"aount as aount:K
-
8/17/2019 manual de Programacion.docx
20/42
IsElJ K !p!odeKIsElJ K 6%= K>3D+5%6XKpaieent"a!ture as p":
K>3D+5%6XKpaieent as pKIsElJ K L6 =3 K>3D+5%6XK!paieent as !p =3
p"paieent J !pidKIsElJ K ;&% p""paieent J pro'id >3D p"""a!ture J K
Io,.e!t-#idIsElJ K =%D% + pdatepKIresElJIthis-#d,-#Euery(IsEl)i" (IresEl)H
Inu J Ithis-#d,-#nuro's(IresEl)IiJ0'hile (Ii < Inu) H
IyQJ9Iro' J Ithis-#d,-#"et!ho,.e!t(IresEl)
Ipd"-#7etX(Ita,9posG: Ita,9topQIy)Ipd"-#ultiCell(20: 9: dolprintdate(Ithis-#d,-
#.date(Iro'-#date):FdayF:"alse:Ioutputlangs:true): 0: FLF: 0)Ipd"-#7etX(Ita,9posGQ21: Ita,9topQIy)Ipd"-#ultiCell(20: 9: pri!e(Isign * Iro'-#aount: 0:
Ioutputlangs): 0: FLF: 0)Ipd"-#7etX(Ita,9posGQ40: Ita,9topQIy)Ioper J Ioutputlangs-
#transnoentitiesno!on8(K5ayentype7hortK Iro'-#!ode)
Ipd"-#ultiCell(20: 9: Ioper: 0: FLF: 0)Ipd"-#7etX(Ita,9posGQ$: Ita,9topQIy)Ipd"-#ultiCell(90: 9: Iro'-#nu: 0: FLF: 0)
Ipd"-#line(Ita,9posG: Ita,9topQIyQ9:Ita,9posGQIta,9'idth: Ita,9topQIyQ9)
IiQQT
TelseH
Ithis-#errorJIthis-#d,-#lasterror()return -1
T
T
/**
-
8/17/2019 manual de Programacion.docx
21/42
* 7ho' is!ellaneous in"oration (payent ode: payent ter: ) * * @para 5D6 Ipd" =,.e!t 5D6 * @para =,.e!t Io,.e!t =,.e!t to
sho' * @para int Iposy * @para ranslate Ioutputlangs Langs o,.e!t * @return 8oid */"un!tion ta,leauin"o(YIpd": Io,.e!t: Iposy: Ioutputlangs)H
glo,al I!on"
Ide"ault"ontsiWe J pd"get5D66ont7iWe(Ioutputlangs)
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1)
// " 6ran!e: sho' O> ention i" not appli!a,lei" (Ithis-#eetteur-#!ountry!ode JJ F6%F YY Ithis-#"ran!hise
JJ 1)H
Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe - 2)Ipd"-#7etX(Ithis-#argegau!he: Iposy)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(KO>s3otsed6orn8oi!eK): 0: FLF: 0)
IposyJIpd"-#et()Q4T
IposG8alJ$2
// 7ho' payents !onditionsi" (Io,.e!t-#type PJ 2 YY (Io,.e!t-#!ondregleent!ode [[
Io,.e!t-#!ondregleent))H
Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe - 2)Ipd"-#7etX(Ithis-#argegau!he: Iposy)Ititre J Ioutputlangs-
#transnoentities(K5ayentConditionsK)FAF
Ipd"-#ultiCell(0: 4: Ititre: 0: FLF)
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 2)Ipd"-#7etX(IposG8al: Iposy)Ili,!onditionpaieentJIoutputlangs-
#transnoentities(K5ayentConditionKIo,.e!t-#!ondregleent!ode)PJ(F5ayentConditionFIo,.e!t-#!ondregleent!ode)?Ioutputlangs-
-
8/17/2019 manual de Programacion.docx
22/42
#transnoentities(K5ayentConditionKIo,.e!t-#!ondregleent!ode)AIoutputlangs-#!on8o=utputCharset(Io,.e!t-#!ondregleentdo!)
Ili,!onditionpaieentJstrrepla!e(FBnF:KBnK:Ili,!onditionpaieent)
Ipd"-#ultiCell(0: 4: Ili,!onditionpaieent:0:FLF)
IposyJIpd"-#et()Q9T
i" (Io,.e!t-#type PJ 2)H
// Che! a payent ode is denedi" (epty(Io,.e!t-#oderegleent!ode)YY epty(I!on"-#glo,al-#6>C%C&Z3+%)YY epty(I!on"-#glo,al-#6>C%%+3+%))H
Ithis-#error J Ioutputlangs-#transnoentities(Krror3o5aieentodeConguredK)
T// >8oid ha8ing any 8alid 5D6 'ith setup that is not
!opleteelsei" ((Io,.e!t-#oderegleent!ode JJ FC&ZF YY
epty(I!on"-#glo,al-#6>C%C&Z3+%))[[ (Io,.e!t-#oderegleent!ode JJ FO%F YY
epty(I!on"-#glo,al-#6>C%%+3+%)))H
Ioutputlangs-#load(KerrorsK)
Ipd"-#7etX(Ithis-#argegau!he: Iposy)Ipd"-#7eteGtColor(200:0:0)Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe - 2)Ithis-#error J Ioutputlangs-
#transnoentities(Krror5ayentodeDenedo;ithout7etupK:Io,.e!t-#oderegleent!ode)
Ipd"-#ultiCell(0: 9: Ithis-#error:0:FLF:0)Ipd"-#7eteGtColor(0:0:0)
IposyJIpd"-#et()Q1T
// 7ho' payent odei" (Io,.e!t-#oderegleent!odeYY Io,.e!t-#oderegleent!ode PJ FC&ZFYY Io,.e!t-#oderegleent!ode PJ FO%F)H
Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe - 2)Ipd"-#7etX(Ithis-#argegau!he: Iposy)
-
8/17/2019 manual de Programacion.docx
23/42
Ititre J Ioutputlangs-#transnoentities(K5ayentodeK)FAF
Ipd"-#ultiCell(0: $: Ititre: 0: FLF)
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 2)Ipd"-#7etX(IposG8al: Iposy)Ili,oderegJIoutputlangs-
#transnoentities(K5ayentypeKIo,.e!t-#oderegleent!ode)PJ(F5ayentypeFIo,.e!t-#oderegleent!ode)?Ioutputlangs-#transnoentities(K5ayentypeKIo,.e!t-#oderegleent!ode)AIoutputlangs-#!on8o=utputCharset(Io,.e!t-#oderegleent)
Ipd"-#ultiCell(0: $: Ili,odereg:0:FLF)
IposyJIpd"-#et()Q2T
// 7ho' payent ode C&Zi" (epty(Io,.e!t-#oderegleent!ode) [[ Io,.e!t-
#oderegleent!ode JJ FC&ZF)H
// 7i ode regleent non "or!e ou si "or!e a C&Zi" (P epty(I!on"-#glo,al-#6>C%C&Z3+%))H
Idi\siWetitleJ(epty(I!on"-#glo,al-#5D6D667]L)?9AI!on"-#glo,al-#5D6D667]L)
i" (I!on"-#glo,al-#6>C%C&Z3+% #0)
HIa!!ount J ne' >!!ount(Ithis-#d,)Ia!!ount-#"et!h(I!on"-#glo,al-
#6>C%C&Z3+%)
Ipd"-#7etX(Ithis-#argegau!he:Iposy)
Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe -Idi\siWetitle)
Ipd"-#ultiCell(100: 9: Ioutputlangs-#transnoentities(F5ayent+yCheEue=rderedoF:Ia!!ount-#proprio):0:FLF:0)
IposyJIpd"-#et()Q1
i" (epty(I!on"-#glo,al-#>35D6&DC&Z>DD%77))
HIpd"-#7etX(Ithis-
#argegau!he: Iposy)
-
8/17/2019 manual de Programacion.docx
24/42
Ipd"-#7et6ont(FF:FF:Ide"ault"ontsiWe - Idi\siWetitle)
Ipd"-#ultiCell(100: 9:Ioutputlangs-#!on8o=utputCharset(Ia!!ount-#o'neraddress): 0: FLF: 0)
IposyJIpd"-#et()Q2 T
Ti" (I!on"-#glo,al-#6>C%C&Z3+% JJ
-1)H
Ipd"-#7etX(Ithis-#argegau!he:Iposy)
Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe -Idi\siWetitle)
Ipd"-#ultiCell(100: 9: Ioutputlangs-#transnoentities(F5ayent+yCheEue=rderedoF:Ithis-#eetteur-#nae):0:FLF:0)
IposyJIpd"-#et()Q1
i" (epty(I!on"-#glo,al-#>35D6&DC&Z>DD%77))
HIpd"-#7etX(Ithis-
#argegau!he: Iposy)Ipd"-#7et6ont(FF:FF:
Ide"ault"ontsiWe - Idi\siWetitle)Ipd"-#ultiCell(100: 9:
Ioutputlangs-#!on8o=utputCharset(Ithis-#eetteur-#get6ull>ddress()): 0:FLF: 0)
IposyJIpd"-#et()Q2 T
TT
T
// " payent ode not "or!ed or "or!ed to O%: sho'payent 'ith +>3
i" (epty(Io,.e!t-#oderegleent!ode) [[ Io,.e!t-#oderegleent!ode JJ FO%F)
Hi" (P epty(Io,.e!t-#",an) [[ P epty(I!on"-
#glo,al-#6>C%%+3+%))H
I,anidJ(epty(Io,.e!t-#",an)?I!on"-#glo,al-#6>C%%+3+%AIo,.e!t-#",an)
Ia!!ount J ne' >!!ount(Ithis-#d,)Ia!!ount-#"et!h(I,anid)
-
8/17/2019 manual de Programacion.docx
25/42
I!urGJIthis-#argegau!heI!uryJIposy
IposyJpd",an(Ipd":Ioutputlangs:I!urG:I!ury:Ia!!ount:0:Ide"ault"ontsiWe)
IposyQJ2T
TT
return IposyT
/** * 7ho' total to pay * * @para 5D6 Ipd" =,.e!t 5D6 * @para 6a!ture Io,.e!t =,.e!t in8oi!e * @para int Ide.aregle ontant de.a regle * @para int Iposy 5osition depart * @para ranslate Ioutputlangs =,.et langs * @return int 5osition pour
suite */"un!tion ta,leautot(YIpd": Io,.e!t: Ide.aregle: Iposy: Ioutputlangs)H
glo,al I!on":Iyso!
IsignJ1 i" (Io,.e!t-#type JJ 2 YY P epty(I!on"-#glo,al-#3O=C5=7OC%D3=)) IsignJ-1
Ide"ault"ontsiWe J pd"get5D66ont7iWe(Ioutputlangs)
Ita,2top J IposyIta,2hl J 4
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1)
// a,leau totalI!ol1G J 120 I!ol2G J 1S0i" (Ithis-#pagelargeur < 210) // o 'or 'ith 7 eGe!uti8e "oratH
I!ol2G-J20T
-
8/17/2019 manual de Programacion.docx
26/42
Ilarg!ol2 J (Ithis-#pagelargeur - Ithis-#argedroite - I!ol2G)
Iuse,orderJ0IindeG J 0
// otal &Ipd"-#7et6illColor(2$$:2$$:2$$)Ipd"-#7etX(I!ol1G: Ita,2top Q 0)Ipd"-#ultiCell(I!ol2G-I!ol1G: Ita,2hl: Ioutputlangs-
#transnoentities(Kotal&K): 0: FLF: 1)Ipd"-#7etX(I!ol2G: Ita,2top Q 0)Ipd"-#ultiCell(Ilarg!ol2: Ita,2hl: pri!e(Isign * (Io,.e!t-
#totalht Q (P epty(Io,.e!t-#reise)?Io,.e!t-#reiseA0)): 0: Ioutputlangs):0: F%F: 1)
// 7ho' O> ,y rates and totalIpd"-#7et6illColor(24:24:24)
Ithis-#atleastoneratenotnullJ0i" (epty(I!on"-#glo,al-
#>33%>D=C37;&=O>))H
It8aisnullJ((P epty(Ithis-#t8a) YY !ount(Ithis-#t8a) JJ 1YY isset(Ithis-#t8aF0000FM) YY is^oat(Ithis-#t8aF0000FM)) ? true A "alse)
i" (P epty(I!on"-#glo,al-#>33%>D=C37;&=O>73LL) YY It8aisnull)
H// 3othing to do
TelseH
//Lo!al taG 1 ,e"ore O>//i" (P epty(I!on"-#glo,al-
#6>C%L=C>L>X1=5=3) YY I!on"-#glo,al-#6>C%L=C>L>X1=5=3JJFlo!altaG1onF)
//H"orea!h( Ithis-#lo!altaG1 as Ilo!altaGtype J#
Ilo!altaGrate )H
i" (inarray((string) Ilo!altaGtype:array(F1F:F9F:F$F))) !ontinue
"orea!h( Ilo!altaGrate as It8aey J#It8a8al )
Hi" (It8aeyPJ0) // =n aN!he pas
tauG 0
-
8/17/2019 manual de Programacion.docx
27/42
H//Ithis-
#atleastoneratenotnullQQ
IindeGQQIpd"-#7etX(I!ol1G:
Ita,2top Q Ita,2hl * IindeG)
It8a!oplJFFi" (pregat!h(F/B*/F:
It8aey))H
It8aeyJstrrepla!e(F*F:FF:It8aey)It8a!opl J K (K
Ioutputlangs-#transnoentities(K3on5er!u%e!upera,leK)K)KT
Itotal8at J Ioutputlangs-#trans!ountrynoentities(KotalL1K:Iyso!-#!ountry!ode)F F
Itotal8atJ8atrate(a,s(It8aey):1)It8a!oplIpd"-#ultiCell(I!ol2G-
I!ol1G: Ita,2hl: Itotal8at: 0: FLF: 1)
Ipd"-#7etX(I!ol2G:Ita,2top Q Ita,2hl * IindeG)
Ipd"-#ultiCell(Ilarg!ol2:Ita,2hl: pri!e(It8a8al: 0: Ioutputlangs): 0: F%F: 1)
TT
T //T
//Lo!al taG 2 ,e"ore O>//i" (P epty(I!on"-#glo,al-
#6>C%L=C>L>X2=5=3) YY I!on"-#glo,al-#6>C%L=C>L>X2=5=3JJFlo!altaG2onF)
//H"orea!h( Ithis-#lo!altaG2 as Ilo!altaGtype J#
Ilo!altaGrate )H
i" (inarray((string) Ilo!altaGtype:array(F1F:F9F:F$F))) !ontinue
"orea!h( Ilo!altaGrate as It8aey J#It8a8al )
H
-
8/17/2019 manual de Programacion.docx
28/42
i" (It8aeyPJ0) // =n aN!he pastauG 0
H//Ithis-
#atleastoneratenotnullQQ
IindeGQQIpd"-#7etX(I!ol1G:
Ita,2top Q Ita,2hl * IindeG)
It8a!oplJFFi" (pregat!h(F/B*/F:
It8aey))H
It8aeyJstrrepla!e(F*F:FF:It8aey)It8a!opl J K (K
Ioutputlangs-#transnoentities(K3on5er!u%e!upera,leK)K)KTItotal8at J Ioutputlangs-
#trans!ountrynoentities(KotalL2K:Iyso!-#!ountry!ode)F F
Itotal8atJ8atrate(a,s(It8aey):1)It8a!oplIpd"-#ultiCell(I!ol2G-
I!ol1G: Ita,2hl: Itotal8at: 0: FLF: 1)
Ipd"-#7etX(I!ol2G:Ita,2top Q Ita,2hl * IindeG)
Ipd"-#ultiCell(Ilarg!ol2:Ita,2hl: pri!e(It8a8al: 0: Ioutputlangs): 0: F%F: 1)
TT
T//T// O>"orea!h(Ithis-#t8a as It8aey J# It8a8al)
Hi" (It8aey # 0) // =n aN!he pas tauG 0H
Ithis-#atleastoneratenotnullQQ
IindeGQQIpd"-#7etX(I!ol1G: Ita,2top Q
Ita,2hl * IindeG)
-
8/17/2019 manual de Programacion.docx
29/42
It8a!oplJFFi" (pregat!h(F/B*/F:It8aey))H
It8aeyJstrrepla!e(F*F:FF:It8aey)
It8a!opl J K (KIoutputlangs-#transnoentities(K3on5er!u%e!upera,leK)K)K
TItotal8at JIoutputlangs-
#transnoentities(KotalO>K)F FItotal8atJ8atrate(It8aey:1)
It8a!oplIpd"-#ultiCell(I!ol2G-I!ol1G: Ita,2hl:
Itotal8at: 0: FLF: 1)
Ipd"-#7etX(I!ol2G: Ita,2top QIta,2hl * IindeG)
Ipd"-#ultiCell(Ilarg!ol2: Ita,2hl:pri!e(It8a8al: 0: Ioutputlangs): 0: F%F: 1)
TT
//Lo!al taG 1 a"ter O>//i" (P epty(I!on"-#glo,al-
#6>C%L=C>L>X1=5=3) YY I!on"-#glo,al-#6>C%L=C>L>X1=5=3JJFlo!altaG1onF)
//H"orea!h( Ithis-#lo!altaG1 as Ilo!altaGtype J#
Ilo!altaGrate )H
i" (inarray((string) Ilo!altaGtype:array(F2F:F4F:FRF))) !ontinue
"orea!h( Ilo!altaGrate as It8aey J#It8a8al )
Hi" (It8aey PJ 0) // =n aN!he
pas tauG 0
H//Ithis-
#atleastoneratenotnullQQ
IindeGQQIpd"-#7etX(I!ol1G:
Ita,2top Q Ita,2hl * IindeG)
-
8/17/2019 manual de Programacion.docx
30/42
It8a!oplJFFi" (pregat!h(F/B*/F:
It8aey))H
It8aeyJstrrepla!e(F*F:FF:It8aey)It8a!opl J K (K
Ioutputlangs-#transnoentities(K3on5er!u%e!upera,leK)K)KTItotal8at J Ioutputlangs-
#trans!ountrynoentities(KotalL1K:Iyso!-#!ountry!ode)F F
Itotal8atJ8atrate(a,s(It8aey):1)It8a!opl
Ipd"-#ultiCell(I!ol2G-I!ol1G: Ita,2hl: Itotal8at: 0: FLF: 1)
Ipd"-#7etX(I!ol2G:Ita,2top Q Ita,2hl * IindeG)
Ipd"-#ultiCell(Ilarg!ol2:Ita,2hl: pri!e(It8a8al: 0: Ioutputlangs): 0: F%F: 1)
TT
T //T
//Lo!al taG 2 a"ter O>//i" (P epty(I!on"-#glo,al-
#6>C%L=C>L>X2=5=3) YY I!on"-#glo,al-#6>C%L=C>L>X2=5=3JJFlo!altaG2onF)
//H"orea!h( Ithis-#lo!altaG2 as Ilo!altaGtype J#
Ilo!altaGrate )H
i" (inarray((string) Ilo!altaGtype:array(F2F:F4F:FRF))) !ontinue
"orea!h( Ilo!altaGrate as It8aey J#It8a8al )
H // retrie8e glo,al lo!al taG
i" (It8aey PJ 0) // =n aN!hepas tauG 0
H//Ithis-
#atleastoneratenotnullQQ
IindeGQQ
-
8/17/2019 manual de Programacion.docx
31/42
Ipd"-#7etX(I!ol1G:Ita,2top Q Ita,2hl * IindeG)
It8a!oplJFFi" (pregat!h(F/B*/F:
It8aey))H
It8aeyJstrrepla!e(F*F:FF:It8aey)It8a!opl J K (K
Ioutputlangs-#transnoentities(K3on5er!u%e!upera,leK)K)KTItotal8at J Ioutputlangs-
#trans!ountrynoentities(KotalL2K:Iyso!-#!ountry!ode)F F
Itotal8atJ8atrate(a,s(It8aey):1)It8a!oplIpd"-#ultiCell(I!ol2G-
I!ol1G: Ita,2hl: Itotal8at: 0: FLF: 1)
Ipd"-#7etX(I!ol2G:Ita,2top Q Ita,2hl * IindeG)
Ipd"-#ultiCell(Ilarg!ol2:Ita,2hl: pri!e(It8a8al: 0: Ioutputlangs): 0: F%F: 1)
TT
//TT
// %e8enue stapi" (pri!e2nu(Io,.e!t-#re8enuestap) PJ 0)H
IindeGQQIpd"-#7etX(I!ol1G: Ita,2top Q Ita,2hl *
IindeG)Ipd"-#ultiCell(I!ol2G-I!ol1G: Ita,2hl:
Ioutputlangs-#transnoentities(K%e8enue7tapK): Iuse,order: FLF: 1)
Ipd"-#7etX(I!ol2G: Ita,2top Q Ita,2hl *
IindeG)Ipd"-#ultiCell(Ilarg!ol2: Ita,2hl: pri!e(Isign
* Io,.e!t-#re8enuestap): Iuse,order: F%F: 1)T
// otal CIindeGQQIpd"-#7etX(I!ol1G: Ita,2top Q Ita,2hl * IindeG)
-
8/17/2019 manual de Programacion.docx
32/42
Ipd"-#7eteGtColor(0:0:R0)Ipd"-#7et6illColor(224:224:224)Ipd"-#ultiCell(I!ol2G-I!ol1G: Ita,2hl:
Ioutputlangs-#transnoentities(KotalCK): Iuse,order: FLF: 1)
Ipd"-#7etX(I!ol2G: Ita,2top Q Ita,2hl * IindeG)Ipd"-#ultiCell(Ilarg!ol2: Ita,2hl: pri!e(Isign *
Io,.e!t-#totaltt!: 0: Ioutputlangs): Iuse,order: F%F: 1)T
T
Ipd"-#7eteGtColor(0:0:0)
I!reditnoteaountJIo,.e!t-#get7uCredit3otessed()IdepositsaountJIo,.e!t-#get7uDepositssed()//print KGKI!reditnoteaountK-KIdepositsaounteGitIresteapayer J pri!e2nu(Io,.e!t-#totaltt! - Ide.aregle -
I!reditnoteaount - Idepositsaount: FF)i" (Io,.e!t-#paye) IresteapayerJ0
i" (Ide.aregle # 0 [[ I!reditnoteaount # 0 [[ Idepositsaount #0)
H// >lready paid Q DepositsIindeGQQIpd"-#7etX(I!ol1G: Ita,2top Q Ita,2hl * IindeG)Ipd"-#ultiCell(I!ol2G-I!ol1G: Ita,2hl: Ioutputlangs-
#transnoentities(K5aidK): 0: FLF: 0)Ipd"-#7etX(I!ol2G: Ita,2top Q Ita,2hl * IindeG)Ipd"-#ultiCell(Ilarg!ol2: Ita,2hl: pri!e(Ide.aregle Q
Idepositsaount: 0: Ioutputlangs): 0: F%F: 0)
// Credit notei" (I!reditnoteaount)H
IindeGQQIpd"-#7etX(I!ol1G: Ita,2top Q Ita,2hl * IindeG)Ipd"-#ultiCell(I!ol2G-I!ol1G: Ita,2hl:
Ioutputlangs-#transnoentities(KCredit3otesK): 0: FLF: 0)
Ipd"-#7etX(I!ol2G: Ita,2top Q Ita,2hl * IindeG)Ipd"-#ultiCell(Ilarg!ol2: Ita,2hl:
pri!e(I!reditnoteaount: 0: Ioutputlangs): 0: F%F: 0)T
// s!optei" (Io,.e!t-#!lose!ode JJ Fdis!ount8atF)H
-
8/17/2019 manual de Programacion.docx
33/42
IindeGQQIpd"-#7et6illColor(2$$:2$$:2$$)
Ipd"-#7etX(I!ol1G: Ita,2top Q Ita,2hl * IindeG)Ipd"-#ultiCell(I!ol2G-I!ol1G: Ita,2hl:
Ioutputlangs-#transnoentities(Ks!opte=\eredK): Iuse,order: FLF: 1)Ipd"-#7etX(I!ol2G: Ita,2top Q Ita,2hl * IindeG)Ipd"-#ultiCell(Ilarg!ol2: Ita,2hl: pri!e(Io,.e!t-
#totaltt! - Ide.aregle - I!reditnoteaount - Idepositsaount: 0:Ioutputlangs): Iuse,order: F%F: 1)
IresteapayerJ0T
IindeGQQIpd"-#7eteGtColor(0:0:R0)Ipd"-#7et6illColor(224:224:224)Ipd"-#7etX(I!ol1G: Ita,2top Q Ita,2hl * IindeG)Ipd"-#ultiCell(I!ol2G-I!ol1G: Ita,2hl: Ioutputlangs-
#transnoentities(K%eaindero5ayK): Iuse,order: FLF: 1)Ipd"-#7etX(I!ol2G: Ita,2top Q Ita,2hl * IindeG)Ipd"-#ultiCell(Ilarg!ol2: Ita,2hl: pri!e(Iresteapayer: 0:
Ioutputlangs): Iuse,order: F%F: 1)
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1)Ipd"-#7eteGtColor(0:0:0)
T
IindeGQQreturn (Ita,2top Q (Ita,2hl * IindeG))
T
/** * 7ho' ta,le "or lines * * @para 5D6 Ipd" =,.e!t 5D6 * @para string Ita,top op position o" ta,le * @para string Ita,height &eight o" ta,le
(re!tangle)
* @para int IneG (not used) * @para ranslate Ioutputlangs Langs o,.e!t * @para int Ihidetop 1J&ide top ,ar
o" array and title: 0J&ide nothing: -1J&ide only title * @para int Ihide,otto &ide ,otto
,ar o" array * @return 8oid */
-
8/17/2019 manual de Programacion.docx
34/42
"un!tion ta,leau(YIpd": Ita,top: Ita,height: IneG: Ioutputlangs:IhidetopJ0: Ihide,ottoJ0)
Hglo,al I!on"
// 6or!e to disa,le hidetop and hide,ottoIhide,ottoJ0i" (Ihidetop) IhidetopJ-1
Ide"ault"ontsiWe J pd"get5D66ont7iWe(Ioutputlangs)
// >ount in (at ta,top - 1)Ipd"-#7eteGtColor(0:0:0)Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 2)
i" (epty(Ihidetop))H
Ititre J Ioutputlangs-#transnoentities(K>ountnCurren!yK:Ioutputlangs-#transnoentitiesno!on8(KCurren!yKI!on"-#!urren!y))
Ipd"-#7etX(Ithis-#pagelargeur - Ithis-#argedroite -(Ipd"-#et7tring;idth(Ititre) Q 9): Ita,top-4)
Ipd"-#ultiCell((Ipd"-#et7tring;idth(Ititre) Q 9): 2:Ititre)
//I!on"-#glo,al-#>35D6L+>CU%=3DC=L=%JF290:290:290F
i" (P epty(I!on"-#glo,al-#>35D6L+>CU%=3DC=L=%)) Ipd"-#%e!t(Ithis-#argegau!he:Ita,top: Ithis-#pagelargeur-Ithis-#argedroite-Ithis-#argegau!he: $:F6F: null: eGplode(F:F:I!on"-#glo,al-#>35D6L+>CU%=3DC=L=%))
T
Ipd"-#7etDra'Color(12:12:12)Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1)
// =utput %e!tIthis-#print%e!t(Ipd":Ithis-#argegau!he: Ita,top: Ithis-
#pagelargeur-Ithis-#argegau!he-Ithis-#argedroite: Ita,height:
Ihidetop: Ihide,otto) // %e!t prend une longueur en 9ee para et 4eepara
i" (epty(Ihidetop))H
Ipd"-#line(Ithis-#argegau!he: Ita,topQ$: Ithis-#pagelargeur-Ithis-#argedroite: Ita,topQ$) // line prend une position yen 2ee para et 4ee para
-
8/17/2019 manual de Programacion.docx
35/42
Ipd"-#7etX(Ithis-#posGdes!-1: Ita,topQ1)Ipd"-#ultiCell(10:2: Ioutputlangs-
#transnoentities(KDesignationK):FF:FLF)T
i" (P epty(I!on"-#glo,al-#>33%>3O=C7;&5C%))
HIpd"-#line(Ithis-#posGpi!ture-1: Ita,top: Ithis-
#posGpi!ture-1: Ita,top Q Ita,height)i" (epty(Ihidetop))H
//Ipd"-#7etX(Ithis-#posGpi!ture-1: Ita,topQ1)//Ipd"-#ultiCell(Ithis-#posGt8a-Ithis-#posGpi!ture-
1:2: Ioutputlangs-#transnoentities(K5hotoK):FF:FCF)T
T
i" (epty(I!on"-#glo,al-#>33%>D=C37;&=O>))
HIpd"-#line(Ithis-#posGt8a-1: Ita,top: Ithis-#posGt8a-1:
Ita,top Q Ita,height)i" (epty(Ihidetop))H
Ipd"-#7etX(Ithis-#posGt8a-9: Ita,topQ1)Ipd"-#ultiCell(Ithis-#posGup-Ithis-#posGt8aQ9:2:
Ioutputlangs-#transnoentities(KO>K):FF:FCF)T
T
Ipd"-#line(Ithis-#posGup-1: Ita,top: Ithis-#posGup-1: Ita,topQ Ita,height)
i" (epty(Ihidetop))H
Ipd"-#7etX(Ithis-#posGup-1: Ita,topQ1)Ipd"-#ultiCell(Ithis-#posGEty-Ithis-#posGup-1:2:
Ioutputlangs-#transnoentities(K5ri!e&K):FF:FCF)
T
Ipd"-#line(Ithis-#posGEty-1: Ita,top: Ithis-#posGEty-1: Ita,topQ Ita,height)
i" (epty(Ihidetop))H
Ipd"-#7etX(Ithis-#posGEty-1: Ita,topQ1)
-
8/17/2019 manual de Programacion.docx
36/42
Ipd"-#ultiCell(Ithis-#posGdis!ount-Ithis-#posGEty-1:2:Ioutputlangs-#transnoentities(KZtyK):FF:FCF)
T
Ipd"-#line(Ithis-#posGdis!ount-1: Ita,top: Ithis-#posGdis!ount-1: Ita,top Q Ita,height)
i" (epty(Ihidetop))H
i" (Ithis-#atleastonedis!ount)H
Ipd"-#7etX(Ithis-#posGdis!ount-1: Ita,topQ1)Ipd"-#ultiCell(Ithis-#postotalht-Ithis-
#posGdis!ountQ1:2: Ioutputlangs-#transnoentities(K%edu!tion7hortK):FF:FCF)T
Ti" (Ithis-#atleastonedis!ount)H
Ipd"-#line(Ithis-#postotalht: Ita,top: Ithis-#postotalht:Ita,top Q Ita,height)
Ti" (epty(Ihidetop))H
Ipd"-#7etX(Ithis-#postotalht-1: Ita,topQ1)Ipd"-#ultiCell(90:2: Ioutputlangs-
#transnoentities(Kotal&K):FF:FCF)T
T
/** * 7ho' top header o" page * * @para 5D6 Ipd" =,.e!t 5D6 * @para =,.e!t Io,.e!t =,.e!t to sho' * @para int Isho'address 0Jno: 1Jyes * @para ranslate Ioutputlangs =,.e!t lang "or output * @return 8oid */"un!tion pagehead(YIpd": Io,.e!t: Isho'address: Ioutputlangs)H
glo,al I!on":Ilangs
Ioutputlangs-#load(KainK)Ioutputlangs-#load(K,illsK)Ioutputlangs-#load(KpropalK)Ioutputlangs-#load(K!opaniesK)
Ide"ault"ontsiWe J pd"get5D66ont7iWe(Ioutputlangs)
-
8/17/2019 manual de Programacion.docx
37/42
pd"pagehead(Ipd":Ioutputlangs:Ithis-#pagehauteur)
// 7ho' Dra"t ;aterari"(Io,.e!t-#statutJJ0 YY (P epty(I!on"-#glo,al-
#6>C%D%>6;>%>%U)) ) H
pd"'aterar(Ipd":Ioutputlangs:Ithis-#pagehauteur:Ithis-#pagelargeur:FF:I!on"-#glo,al-#6>C%D%>6;>%>%U) T
Ipd"-#7eteGtColor(0:0:R0)Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe Q 9)
IposyJIthis-#argehaute IposGJIthis-#pagelargeur-Ithis-#argedroite-100
Ipd"-#7etX(Ithis-#argegau!he:Iposy)
// LogoIlogoJI!on"-#y!opany-#diroutputF/logos/FIthis-#eetteur-
#logoi" (Ithis-#eetteur-#logo)H
i" (isreada,le(Ilogo))H IheightJpd"get&eight6orLogo(Ilogo)
Ipd"-#age(Ilogo: Ithis-#argegau!he: Iposy: 0:Iheight) // 'idthJ0 (auto)
TelseH
Ipd"-#7eteGtColor(200:0:0)Ipd"-#7et6ont(FF:F+F:Ide"ault"ontsiWe - 2)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(KrrorLogo6ile3ot6oundK:Ilogo): 0: FLF)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(Krroroolo,al7etupK): 0: FLF)T
TelseH
IteGtJIthis-#eetteur-#naeIpd"-#ultiCell(100: 4: Ioutputlangs-
#!on8o=utputCharset(IteGt): 0: FLF)T
-
8/17/2019 manual de Programacion.docx
38/42
Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe Q 9)Ipd"-#7etX(IposG:Iposy)Ipd"-#7eteGtColor(0:0:R0)ItitleJIoutputlangs-#transnoentities(Kn8oi!eK)i" (Io,.e!t-#type JJ 1) ItitleJIoutputlangs-
#transnoentities(Kn8oi!e%epla!eentK)i" (Io,.e!t-#type JJ 2) ItitleJIoutputlangs-
#transnoentities(Kn8oi!e>8oirK)i" (Io,.e!t-#type JJ 9) ItitleJIoutputlangs-
#transnoentities(Kn8oi!eDepositK)i" (Io,.e!t-#type JJ 4) ItitleJIoutputlangs-
#transnoentities(Kn8oi!e5ro6oratK)Ipd"-#ultiCell(100: 9: Ititle: FF: F%F)
Ipd"-#7et6ont(FF:F+F:Ide"ault"ontsiWe)
IposyQJ$Ipd"-#7etX(IposG:Iposy)Ipd"-#7eteGtColor(0:0:R0)Ipd"-#ultiCell(100: 4: Ioutputlangs-#transnoentities(K%e"K)K A K
Ioutputlangs-#!on8o=utputCharset(Io,.e!t-#re"): FF: F%F)
IposyQJ1Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 2)
i" (Io,.e!t-#re"!lient)H
IposyQJ4Ipd"-#7etX(IposG:Iposy)Ipd"-#7eteGtColor(0:0:R0)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(K%e"CustoerK)K A K Ioutputlangs-#!on8o=utputCharset(Io,.e!t-#re"!lient): FF: F%F)
T
Io,.e!tidneGtJIo,.e!t-#getd%epla!ingn8oi!e(F8alidatedF)i" (Io,.e!t-#type JJ 0 YY Io,.e!tidneGt)H
Io,.e!trepla!ingJne' 6a!ture(Ithis-#d,)
Io,.e!trepla!ing-#"et!h(Io,.e!tidneGt)
IposyQJ9Ipd"-#7etX(IposG:Iposy)Ipd"-#7eteGtColor(0:0:R0)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(K%epla!eent+yn8oi!eK)F A FIoutputlangs-#!on8o=utputCharset(Io,.e!trepla!ing-#re"): FF: F%F)
-
8/17/2019 manual de Programacion.docx
39/42
Ti" (Io,.e!t-#type JJ 1)H
Io,.e!trepla!edJne' 6a!ture(Ithis-#d,)Io,.e!trepla!ed-#"et!h(Io,.e!t-#""a!turesour!e)
IposyQJ4Ipd"-#7etX(IposG:Iposy)Ipd"-#7eteGtColor(0:0:R0)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(K%epla!eentn8oi!eK)F A FIoutputlangs-#!on8o=utputCharset(Io,.e!trepla!ed-#re"): FF: F%F)
Ti" (Io,.e!t-#type JJ 2)H
Io,.e!trepla!edJne' 6a!ture(Ithis-#d,)Io,.e!trepla!ed-#"et!h(Io,.e!t-#""a!turesour!e)
IposyQJ9Ipd"-#7etX(IposG:Iposy)Ipd"-#7eteGtColor(0:0:R0)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(KCorre!tionn8oi!eK)F A FIoutputlangs-#!on8o=utputCharset(Io,.e!trepla!ed-#re"): FF: F%F)
T
IposyQJ4Ipd"-#7etX(IposG:Iposy)Ipd"-#7eteGtColor(0:0:R0)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(KDaten8oi!eK)K A K dolprintdate(Io,.e!t-#date:KdayK:"alse:Ioutputlangs): FF: F%F)
i" (Io,.e!t-#type PJ 2)H
IposyQJ9Ipd"-#7etX(IposG:Iposy)Ipd"-#7eteGtColor(0:0:R0)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(KDate!hean!eK)K A K dolprintdate(Io,.e!t-#dateliregleent:KdayK:"alse:Ioutputlangs:true): FF: F%F)
T
i" (Io,.e!t-#!lient-#!ode!lient)H
IposyQJ9Ipd"-#7etX(IposG:Iposy)
-
8/17/2019 manual de Programacion.docx
40/42
Ipd"-#7eteGtColor(0:0:R0)Ipd"-#ultiCell(100: 9: Ioutputlangs-
#transnoentities(KCustoerCodeK)K A K Ioutputlangs-#transnoentities(Io,.e!t-#!lient-#!ode!lient): FF: F%F)
T
IposyQJ1
// 7ho' list o" lined o,.e!tsIposy J pd"'riteLined=,.e!ts(Ipd": Io,.e!t: Ioutputlangs:
IposG: Iposy: 100: 9: F%F: Ide"ault"ontsiWe)
i" (Isho'address)H
// 7ender propertiesI!ara!eetteur J pd",uildaddress(Ioutputlangs: Ithis-
#eetteur: Io,.e!t-#!lient)
// 7ho' senderIposyJ42IposGJIthis-#argegau!hei" (P epty(I!on"-#glo,al-
#>33O%73D%%C53)) IposGJIthis-#pagelargeur-Ithis-#argedroite-0
Ihaut!adreJ40
// 7ho' sender "raeIpd"-#7eteGtColor(0:0:0)Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 2)Ipd"-#7etX(IposG:Iposy-$)Ipd"-#ultiCell(RR:$: Ioutputlangs-
#transnoentities(K+ill6roK)KAK: 0: FLF)Ipd"-#7etX(IposG:Iposy)Ipd"-#7et6illColor(290:290:290)Ipd"-#ultiCell(2: Ihaut!adre: KK: 0: F%F: 1)Ipd"-#7eteGtColor(0:0:R0)
// 7ho' sender naeIpd"-#7etX(IposGQ2:IposyQ9)
Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe)Ipd"-#ultiCell(0: 4: Ioutputlangs-
#!on8o=utputCharset(Ithis-#eetteur-#nae): 0: FLF)IposyJIpd"-#get()
// 7ho' sender in"orationIpd"-#7etX(IposGQ2:Iposy)Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1)
-
8/17/2019 manual de Programacion.docx
41/42
Ipd"-#ultiCell(0: 4: I!ara!eetteur: 0: FLF)
// " +LL3 !onta!t dened on in8oi!e: 'e use itIuse!onta!tJ"alseIarrayid!onta!tJIo,.e!t-
#getdConta!t(FeGternalF:F+LL3F)i" (!ount(Iarrayid!onta!t) # 0)H
Iuse!onta!tJtrueIresultJIo,.e!t-#"et!h!onta!t(Iarrayid!onta!t0M)
T
// %e!ipient naei" (P epty(Iuse!onta!t))H
// =n peut utiliser le no de la so!iete du !onta!ti" (P epty(I!on"-#glo,al-
#>37C=5>33>=6C=3>C)) Iso!nae J Io,.e!t-#!onta!t-#so!nae
else Iso!nae J Io,.e!t-#!lient-#naeI!ara!!lientnaeJIoutputlangs-
#!on8o=utputCharset(Iso!nae)TelseH
I!ara!!lientnaeJIoutputlangs-#!on8o=utputCharset(Io,.e!t-#!lient-#nae)
T
I!ara!!lientJpd",uildaddress(Ioutputlangs:Ithis-#eetteur:Io,.e!t-#!lient:(Iuse!onta!t?Io,.e!t-#!onta!tAFF):Iuse!onta!t:FtargetF)
// 7ho' re!ipientI'idthre!,oGJ100i" (Ithis-#pagelargeur < 210) I'idthre!,oGJ4 // o
'or 'ith 7 eGe!uti8e "orat
IposyJ42IposGJIthis-#pagelargeur-Ithis-#argedroite-
I'idthre!,oGi" (P epty(I!on"-#glo,al-
#>33O%73D%%C53)) IposGJIthis-#argegau!he
// 7ho' re!ipient "raeIpd"-#7eteGtColor(0:0:0)
-
8/17/2019 manual de Programacion.docx
42/42
Ipd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 2)Ipd"-#7etX(IposGQ2:Iposy-$)Ipd"-#ultiCell(I'idthre!,oG: $: Ioutputlangs-
#transnoentities(K+illoK)KAK:0:FLF)Ipd"-#%e!t(IposG: Iposy: I'idthre!,oG: Ihaut!adre)
// 7ho' re!ipient naeIpd"-#7etX(IposGQ2:IposyQ9)Ipd"-#7et6ont(FF:F+F: Ide"ault"ontsiWe)Ipd"-#ultiCell(I'idthre!,oG: 4: I!ara!!lientnae: 0: FLF)
// 7ho' re!ipient in"orationIpd"-#7et6ont(FF:FF: Ide"ault"ontsiWe - 1)Ipd"-#7etX(IposGQ2:IposyQ4Q
(doln,o^ines,is(I!ara!!lientnae:$0)*4))Ipd"-#ultiCell(I'idthre!,oG: 4: I!ara!!lient: 0: FLF)
T
Ipd"-#7eteGtColor(0:0:0)T
/** * 7ho' "ooter o" page 3eed this-#eetteur o,.e!t
* * @para 5D6 Ipd" 5D6 * @para =,.e!t Io,.e!t=,.e!t to sho' * @para ranslate Ioutputlangs =,.e!t lang "or
output * @para int Ihide"reeteGt 1J&ide
"ree teGt * @return int%eturn height o" ,otto argin in!luding "ooter teGt */"un!tion page"oot(YIpd":Io,.e!t:Ioutputlangs:Ihide"reeteGtJ0)H
Isho'detailsJ0return pd"page"oot(Ipd":Ioutputlangs:F6>C%6%XF:
Ithis-#eetteur:Ithis-#arge,asse:Ithis-#argegau!he:Ithis-
#pagehauteur:Io,.e!t:Isho'details:Ihide"reeteGt)T
T