jeudi 19 mai 2016

R12 - Insertion de pièces GL - rééquilibrages des livres primaires/secondaires

R12 - Insertion de pièces GL - rééquilibrages des livres primaires/secondaires

Des pièces GL sont présentes dans le livre PRIMAIRE mais sont absentes dans le livre SECONDAIRE. Il faudrait récupérer ces pièces manquantes et les intégrer dans le second livre. Certaines pièces sont partiellement manquantes.

Méthode :
1 – Sélection des lots du mois considéré
SELECT distinct gjb.je_batch_id,gll.name, gjh.period_name, gjb.name, gjb.RUNNING_TOTAL_CR, gjb.RUNNING_TOTAL_DR, gjb.RUNNING_TOTAL_ACCOUNTED_CR, gjb.RUNNING_TOTAL_ACCOUNTED_DR
FROM gl_je_batches gjb, gl_je_headers gjh,gl_ledgers gll
WHERE gjb.je_batch_id = gjh.je_batch_id
AND gjh.ledger_id = gll.ledger_id
AND gjh.ledger_id IN (2259, 2596)
AND gjh.currency_code != 'STAT'
AND gjb.status = 'P' -- lot imputé
AND gjh.period_name IN ('APR-15')--, 'JUN-15')
ORDER BY gjb.name,gjh.period_name, gjb.RUNNING_TOTAL_CR

  
2 – Export Excel des données
Contrôler les lots (lots manquants, lots partiels, lots présents) entre les deux livres. Bien marquer ces catégories.

 
3 – Passer la requête d’INSERT (option : en excluant les lots partiels) dans GL_INTERFACE
Paramètres : mois
En dur :
gjh.ledger_id = 2259 -- LIVRE_PRIMAIRE
gll.name='_LIVRE_PRIMAIRE'
AND gll2.name='LIVRE_SECONDAIRE'


INSERT INTO GL_INTERFACE (status, ledger_id, accounting_date, currency_code, date_created, created_by, actual_flag, user_je_category_name,user_je_source_name
,segment1,segment2,segment3,segment4,segment5,segment6,segment7,segment8,segment9
,entered_dr,entered_cr,accounted_dr,accounted_cr
,period_name
,reference1 --batch name
,reference4 --Journal entry name
,reference5 --Journal entry description gjh.desciption
,reference10 -- Journal entry line description gjl.description
,reference25 -- gjl.refrence5
,reference26 -- gjl.refrence6
,reference27 -- gjl.refrence7
,reference28 -- gjl.refrence8
,reference29 -- gjl.refrence9
,reference30 -- gjl.refrence10
,GL_SL_LINK_ID --Renseigné par Oracle Subledger Accounting (SLA) pour indiquer le lien de la tansaction d'origine
,GL_SL_LINK_TABLE --Renseigné par Oracle Subledger Accounting (SLA) pour indiquer la table de la transaction d'origine
,subledger_doc_sequence_value
,subledger_doc_sequence_id
)
SELECT 'NEW'
,2596 -- LIVRE_SECONDAIRE
,gjl.effective_date, gjh.currency_code, sysdate, gjl.created_by, 'A' ,gjc.user_je_category_name, gjs.user_je_source_name
-- éléments de la clef comptables :
 ,gcc.segment1 
 ,'000000' 
 ,'00'
 ,'000'
 ,'0000'
 ,'0000'
 ,gcc.Segment7
 ,gcc.segment8 
,gcc.Segment9
,gjl.entered_dr,gjl.entered_cr,gjl.accounted_dr,gjl.accounted_cr
,gjh.period_name
,SUBSTR('R '||gjb.je_batch_id||' '||gjb.name,1,100) --- batch name
,gjh.name
,gjh.DESCRIPTION
,gjl.description
,gjl.reference_5
,gjl.reference_6
,gjl.reference_7
,gjl.reference_8
,gjl.reference_9
,gjl.reference_10
,gjl.GL_SL_LINK_ID
,gjl.GL_SL_LINK_TABLE
,gjl.subledger_doc_sequence_value
,gjl.subledger_doc_sequence_id
FROM GL_JE_BATCHES gjb
,GL_JE_HEADERS gjh
,GL_JE_LINES gjl
,GL_JE_CATEGORIES_TL gjc
,GL_JE_SOURCES_TL gjs
,GL_CODE_COMBINATIONS gcc
WHERE gcc.code_combination_id = gjl.code_combination_id
AND gjs.language = 'F'
AND gjs.JE_SOURCE_NAME = gjh.JE_SOURCE
AND gjc.language = 'F'
AND gjc.JE_CATEGORY_NAME = gjh.JE_CATEGORY
AND gjl.je_header_id = gjh.je_header_id
AND gjb.je_batch_id = gjh.je_batch_id
and gjh.ledger_id = 2259 -- LIVRE_PRIMAIRE
AND gjh.currency_code != 'STAT'
AND gjb.status = 'P' -- lot imputé
AND gjb.name IN (-- SELECTION DES LOTS --
SELECT --distinct gll.name, gjh.period_name, gjb.name, gjb.RUNNING_TOTAL_CR, gjb.RUNNING_TOTAL_DR
distinct gjb.name
FROM gl_je_batches gjb, gl_je_headers gjh, gl_ledgers gll
WHERE gjb.je_batch_id = gjh.je_batch_id
AND gjh.ledger_id = gll.ledger_id
AND gjh.period_name IN ('APR-15') --, 'MAY-15', 'JUN-15')
AND gll.name='LIVRE_PRIMAIRE'
AND NOT EXISTS (SELECT 'X' -- On enlève les lots déjà intégrés (même montant ici sinon trouver un caractère discriminatoire)
FROM gl_je_batches gjb2,gl_ledgers gll2,gl_je_headers gjh2
WHERE gjh2.ledger_id = gll2.ledger_id
AND gjb2.je_batch_id = gjh2.je_batch_id
AND gll2.name='LIVRE_SECONDAIRE'
AND gjh2.period_name = gjh.period_name
AND gjb.RUNNING_TOTAL_CR = gjb2.RUNNING_TOTAL_CR
AND gjb.RUNNING_TOTAL_DR = gjb2.RUNNING_TOTAL_DR
))

 
-- partie optionnelle s'il faut enlever les lots partiellements intégrés de la liste (identification manuelle) --
-- et/ou intégration dans un second temps après contrepassation des lots
AND gjb.name NOT IN
('Comptes fournisseurs A 833344 5471103'
,'Comptes fournisseurs A 837351 5495545'
,'Comptes fournisseurs A 844348 5522463'
,'Comptes fournisseurs A 844450 5530738'
,'Comptes fournisseurs A 845357 5538580'
,'Comptes fournisseurs A 850428 5571373'
,'Comptes fournisseurs A 850687 5587094'
,'Comptes fournisseurs A 850794 5594447'
,'Comptes fournisseurs A 851349 5601954'
,'Comptes fournisseurs A 853447 5628990'
,'Comptes fournisseurs A 855446 5638900'
)


 
Valider la transaction (COMMIT)

4) Lancer l’Easylink

Aller dans la responsabilité GL du livre secondaire (M)Pièces/importer/Lancer

Pour visionner ce qu'il y a dans GL_INTERFACE :
SELECT distinct(user_je_source_name) from gl_interface where ledger_id IN (2596) -- => Comptes fournisseurs ; Manuelle

 

 
A ce stade, si on veut repasser l’insert celui-ci ne devrait pas fonctionner car il trouve les lots existants avec les mêmes montants (ou le même caractère discriminatoire).

 
5) Rechercher les nouveaux lots créés puis contrôler les montants

-- Liste des lots importés
SELECT *
FROM gl_je_batches gjb
WHERE name like 'R %'
AND gjb.status = 'U'
-- Liste des pièces importées
select gjh.* from gl_je_headers gjh,gl_je_batches gjb
WHERE gjh.ledger_id = 2596
AND gjb.je_batch_id = gjh.je_batch_id
and gjb.name like 'R %'
AND gjb.status = 'U'

select gjl.* from gl_je_headers gjh, gl_je_lines gjl,gl_je_batches gjb
WHERE gjh.ledger_id = 2596
AND gjb.je_batch_id = gjh.je_batch_id
and gjb.name like 'R %'
AND gjb.status = 'U'
and gjh.je_header_id = gjl.je_header_id
select sum(gjh.running_total_dr),sum(gjh.running_total_cr),sum(gjh.running_total_accounted_dr),sum(gjh.running_total_accounted_cr)
from gl_je_headers gjh,gl_je_batches gjb
WHERE gjh.ledger_id = 2596
AND gjb.je_batch_id = gjh.je_batch_id
and gjb.name like 'R %'
AND gjb.status = 'U'

La somme correspond à la somme des lots dans le fichier extrait (préalablement repérées par un code couleur)

6) Demander la contrepassation des lots ‘partiels’, puis intégrer ces lots si ce n'est déjà fait.



Aucun commentaire: