Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public subroutine of_scrivi_dettagli_cnsm (ref xxxu021_data_store_base ads_cnsm_fisle, ref xxxu021_data_store_base ads_cnsm_insert, ref xxxu021_data_store_base ads_joint, string as_c_cmp, integer ai_mese, integer ai_anno);/*
- Funzione :
- of_scrivi_dettagli_cnsm(ads_cnsm_fisle, ads_cnsm_insert, ai_mese, ai_anno)
- Valore di Ritorno :
- Nessuno.
- Parametri :
- xxxu021_data_store_base ads_cnsm_fisle (DS con i dati da salvati nelle chiusure CMP_CNSM_T029 e CNSM_JNT_T192)
- xxxu021_data_store_base ads_cnsm_insert (DS con i dati da calcolare CMP_CNSM_CDP_T199)
- xxxu021_data_store_base ads_joint (DS con i dati delle Joint PRTNR_CMP_T165)
- Integer ai_mese (Mese di riferimento) Non utilizzato
- Integer ai_anno (Anno di riferimento) Non utilizzato
- Descrizione :
- La funzione si preoccupa di calcolare i dati da inviare per il dettaglio del
- consumato.
- */
- Long ll_chiusure, ll_riga, ll_find, ll_nuove_righe
- Double l_dbl_add, l_dbl_val
- String ls_c_prdt, ls_c_soc, ls_f100, ls_c_dest, ls_flag_joint, ls_old_filter
- String ls_cnsm_grp, ls_cnsm_tip, ls_find_string
- Integer li_mese_succ, li_anno_succ
- Date ld_rif
- // MK Modifica del 05/09/2007
- // Non serve a nulla!
- //// Calcolo l'ultimo giorno del mese
- //li_mese_succ = ai_mese + 1
- //if li_mese_succ = 13 Then
- // li_anno_succ = ai_anno + 1
- // li_mese_succ = 1
- //Else
- // li_anno_succ = ai_anno
- //End if
- // MK Fine modifica del 05/09/2007
- // Memorizza il filtro corrente per ripristinarlo alla fine
- ls_old_filter = ads_joint.Describe("Datawindow.Table.Filter")
- For ll_chiusure = 1 To ads_cnsm_fisle.RowCount()
- ls_c_prdt = ads_cnsm_fisle.GetItemString(ll_chiusure, "c_prdt")
- ls_cnsm_grp = ads_cnsm_fisle.GetItemString(ll_chiusure, "c_cnsm_grp")
- ls_cnsm_tip = ads_cnsm_fisle.GetItemString(ll_chiusure, "c_cnsm_tip")
- ls_c_soc = ads_cnsm_fisle.GetItemString(ll_chiusure, "c_soc")
- ls_f100 = ads_cnsm_fisle.GetItemString(ll_chiusure, "f_100")
- ld_rif = Date(ads_cnsm_fisle.GetItemDateTime(ll_chiusure, "d_rif"))
- ads_joint.SetFIlter("c_cmp = '" + as_c_cmp + "' and c_prdt = '" + ls_c_prdt + "'")
- ads_joint.Filter()
- if (ls_c_soc = is_agip) And (ls_f100 = 'S') Then
- // Dato di stoccaggio : da salvare con il 100% agip
- ls_c_soc = ' '
- End if
- // Stabilisce il valore di ls_flag_joint
- if ls_c_soc <> ' ' Then
- if ls_f100 = 'S' Then
- // DAto di stoccaggio (non ci sono mai partners) quindi è 100%
- ls_flag_joint = 'T'
- Else
- ll_find = ads_joint.Find("c_soc = '"+ls_c_soc+"'",0,ads_joint.RowCount())
- if ll_find > 0 Then
- if ads_joint.GetItemString(ll_find,"f_agip") = 'S' Then
- ls_flag_joint = 'Q' // Dato di Quota per Agip
- Else
- ls_flag_joint = ' ' // Dato di Quota per Soc. div. da Agip
- End if
- Else
- ls_flag_joint = ' ' // Dato di quota per Soc. div. da Agip
- End if
- End if
- Else
- if ads_joint.RowCOunt() > 0 Then
- ls_flag_joint = 'J' // 100 % con presenza di Joint Ventures
- Else
- ls_flag_joint = 'T' // 100 % senza Joint Ventures
- End if
- End if
- ls_find_string = "c_cmp = '" + as_c_cmp + "' And c_prdt = '"+ls_c_prdt+"' And c_soc = '"+ls_c_soc+ &
- "' and c_cnsm_grp = '"+ls_cnsm_grp+"' And c_cnsm_tip = '"+ls_cnsm_tip+ &
- "' and f_100 = '"+ls_f100+"' And d_rif = Date('"+&
- String(ld_rif,'dd/mm/yyyy')+"')"
- ll_find = ads_cnsm_insert.Find(ls_find_string,0,ads_cnsm_insert.RowCOunt())
- if ll_find = 0 Then
- ll_riga = ads_cnsm_insert.InsertRow(0)
- ll_nuove_righe++
- ads_cnsm_insert.SetItem(ll_riga,"c_cmp",as_c_cmp)
- ads_cnsm_insert.SetItem(ll_riga,"c_cnsm_grp", ls_cnsm_grp)
- ads_cnsm_insert.SetItem(ll_riga,"c_cnsm_tip", ls_cnsm_tip)
- ads_cnsm_insert.SetItem(ll_riga,"c_prdt",ls_c_prdt)
- ads_cnsm_insert.SetItem(ll_riga,"c_soc", ls_c_soc)
- ads_cnsm_insert.SetItem(ll_riga,"d_rif", ld_rif)
- ads_cnsm_insert.SetItem(ll_riga,"f_100", ls_f100)
- ads_cnsm_insert.SetItem(ll_riga,"f_jnt", ls_flag_joint)
- Else
- ll_riga = ll_find
- End if
- // Leggo i valori del consumato
- l_dbl_add = ads_cnsm_fisle.GetItemNumber(ll_chiusure,"v_cnsm")
- l_dbl_val = ads_cnsm_insert.GetItemNumber(ll_riga,"v_cnsm")
- if IsNull(l_dbl_val) Then
- If Not(IsNull(l_dbl_add)) Then
- // Se il valore già presente è nullo, ma il nuovo no......
- l_dbl_val = 0
- End if
- Else
- if IsNull(l_dbl_add) Then
- // se il vecchio non è nullo, ma il nuovo si......
- l_dbl_add = 0
- End if
- End if
- l_dbl_val += l_dbl_add
- ads_cnsm_insert.SetItem(ll_riga,"v_cnsm",l_dbl_val)
- Next
- // Riapplica il filtro orginale
- ads_joint.SetFIlter(ls_old_filter )
- ads_joint.Filter()
- end subroutine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement