//============================================================================== // Woorm code behind //============================================================================== Release 7 Rect (54,56,481,753) PageInfo (2,9,2970,2100,100,1,1,True ) PageLayout "default" Begin Text (14,6,44,408) "Lista di spunta Elenco Fornitori" Begin Align 2128 ; FontStyle "ListTitle" ; Borders (0,0,0,0) ; End Field (14,409,44,546) Alias 78 FormatStyle "Integer" Begin Align 2153 ; FontStyle "ListTitle" ; Borders (0,0,0,0) ; End Text (26,885,40,1054) "Selezioni effettuate:" Begin Align 2128 ; FontStyle "AccessoryDescription" ; Borders (0,0,0,0) ; End Field (45,885,59,1054) Alias 34 Begin Align 2150 ; Borders (0,0,0,0) ; Label "Dal fornitore" End Text (51,4,90,93) Begin "Ragione Sociale" "Dichiarante" End Begin Align 2128 ; Borders (1,1,1,0) ; End Field (51,93,90,408) Alias 1 Begin Align 2136 ; FontStyle "FiscalListSubTitle" ; Borders (1,0,1,1) ; End Field (51,407,90,666) Alias 83 Begin Align 2153 ; FontStyle "FiscalListSubTitle" ; Label "Part. IVA Dichiarante" End Field (61,885,75,1054) Alias 35 Begin Align 2150 ; Borders (0,0,0,0) ; Label "Al fornitore" End Text (728,998,746,1031) "pag." Begin Align 2128 ; FontStyle "AccessoryDescription" ; Borders (0,0,0,0) ; End Field (726,1028,745,1061) Alias 3 FormatStyle "Integer" Begin Align 2153 ; FontStyle "AccessoryDescription" ; Borders (0,0,0,0) ; End Table (37,16) "ELENCO FORNITORI" Alias 7 Origin (4,89) Heights (18,32,15,17) Begin "CliFor" Alias 5 Width 49 ; "Ragione Sociale" Alias 6 Width 120 ; "Tipo" Alias 335 Width 36 ; "" Alias 324 Width 0 FormatStyle "Long" Hidden Width 100 ; "Data Doc" Alias 333 Width 60 FormatStyle "Date" ; "Nr.Doc" Alias 332 Width 80 ; "Cod. IVA" Alias 329 Width 35 ; "Nr.di Ft." Alias 88 Width 34 FormatStyle "Long" Total ; "Imponibile" Alias 9 Width 91 FormatStyle "Currency" Total ; "IVA" Alias 10 Width 91 FormatStyle "Currency" Total ; "Non imponibile" Alias 90 Width 81 FormatStyle "Currency" Total ; "Esente" Alias 14 Width 85 FormatStyle "Currency" Total ; "Op.Imp. IVA non esp" Alias 92 Width 76 FormatStyle "Currency" Total ; "Op.Imp. con IVA" Alias 301 Width 72 FormatStyle "Money" Total ; "IMPORTI IGNORATI" Alias 337 Width 72 FormatStyle "Money" Total ; "TOTALE" Alias 22 Width 91 FormatStyle "Currency" Total ; Title Begin Column (0,13) Align 2133 ; Column (14) TextColor (128,0,0) Align 2133 ; Column (15) Align 2133 ; End ColTotal Begin Column (1) Align 2132 ; Column (2) Align 2149 ; Column (7) Align 2149 ; End Body Begin Cell (0,2,36,2) Align 2149 ; Cell (0,7,36,7) Align 2149 ; End End Text (732,207,752,923) "Legenda colonna Tipo: M = Dati inseriti manualmente, NV Nota di variazione relativa a fatture di anni precedenti" Begin Align 2128 ; FontStyle "AccessoryDescription" ; Borders (0,0,0,0) ; End Text (693,4,711,384) "Totali generali" Align 2146 ; Field (731,6,749,157) Alias 2 FormatStyle "Date" Begin Align 2148 ; FontStyle "AccessoryDescription" ; Borders (0,0,0,0) ; End End Links Begin LinkForm "ERP.CustomersSuppliers.Documents.Suppliers" On CustSupp Begin Enum[49] CustSuppType = {49:1} ; String CustSupp = CustSupp ; End LinkForm "ERP.Accounting.Documents.PurchaseDocJE" On NrDoc Begin Long JournalEntryId = PNIVA_IdPNota ; End End Report Begin NoName Tables Tabella_1 [37] Alias 7 ; End Variables String w_CompanyName [64] Alias 1 ; Date ApplicationDate [8] Alias 2 Init = AppDate ( ) ; Integer w_NrPage [6] = w_NrPage + 1 Alias 3 Init = 1 ; String CustSupp [9] Alias 5 Column ; String CustCompanyName [23] Alias 6 Column ; Money TaxableAmount [15] Alias 9 Column ; Money TaxAmount [15] Alias 10 Column ; Money Exempt [15] Alias 14 Column ; Money TotalAmount [15] Alias 22 Column ; String CustSuppStart [12] Alias 34 Input Init = "" ; String CustSuppEnd [12] Alias 35 Input Init = "" ; Money TotTaxableAmount = Csum (TaxableAmount ) Alias 39 ColTotal ; Money TotExempt = Csum (Exempt ) Alias 41 ColTotal ; Money TotTotalAmount = Csum (TotalAmount ) Alias 45 ColTotal ; Money TotTax = Csum (TaxAmount ) Alias 47 ColTotal ; Integer w_ParamCurrYear [5] Alias 50 Hidden Init = 0 ; Integer CurrYear [5] Alias 78 Input Init = w_ParamCurrYear == 0 ? Year ( AppDate ( ) ) - 1 : w_ParamCurrYear ; String PartIVADichiarante [12] Alias 83 ; Bool CreditNotes [2] Alias 87 Hidden ; Long NumberOfInvoices [12] Alias 88 Column ; Long TotNumberOfInvoices = Csum (NumberOfInvoices ) Alias 89 ColTotal ; Money NoTaxable [23] Alias 90 Column ; Money TotNoTaxable = Csum (NoTaxable ) Alias 91 ColTotal ; Money TaxAmountNotInInvoice [23] Alias 92 Column ; Money TotTaxAmountNotInInvoice = Csum (TaxAmountNotInInvoice ) Alias 93 ColTotal ; Bool FirstTime [2] Alias 100 Hidden Init = TRUE ; Money TaxableAmountWithTax [23] Alias 301 Column ; Money TotTaxableAmountWithTax = Csum (TaxableAmountWithTax ) Alias 302 ColTotal ; Long TotCustSuppNumberOfInvoices [12] = Csum (NumberOfInvoices ) Alias 288 SubTotal ; Money TotCustSuppTaxableAmount [15] = Csum (TaxableAmount ) Alias 289 SubTotal ; Money TotCustSuppTaxAmount [15] = Csum (TaxAmount ) Alias 290 SubTotal ; Money TotCustSuppExempt [15] = Csum (Exempt ) Alias 291 SubTotal ; Money TotCustSuppTotalAmount [15] = Csum (TotalAmount ) Alias 292 SubTotal ; Money TotCustSuppNoTaxable [23] = Csum (NoTaxable ) Alias 293 SubTotal ; Money TotCustSuppTaxAmountNotInInvoice [23] = Csum (TaxAmountNotInInvoice ) Alias 294 SubTotal ; Money TotCustSuppTaxableAmountWithTax [23] = Csum (TaxableAmountWithTax ) Alias 304 SubTotal ; Enum[49] w_Custsupptype [15] Alias 300 Hidden Init = { 49 : 1 } ; Enum[142] NaturaDefinitiva [15] Alias 320 Hidden Input Init = { 142 : 0 } ; Date w_StartDate [8] Alias 321 Hidden Input ; Date w_EndingDate [8] Alias 322 Hidden Input ; Enum[5] SegnoIVA [15] Alias 323 Hidden ; Long PNIVA_IdPNota [12] Alias 324 Column ; Money ImponibileFiscale [23] Alias 325 Hidden ; Money ImpostaFiscale [23] Alias 326 Hidden ; Integer PNIVAR_Riga [6] Alias 327 Hidden ; Integer PNIVAR_Riga_OLD [6] Alias 328 Hidden Init = 0 ; String PNIVAR_CodIVA [6] Alias 329 Column ; Enum[188] TipoElencoClienti [15] Alias 330 Hidden Init = { 188 : 0 } ; Enum[188] TipoElencoFornitori [15] Alias 331 Hidden Init = { 188 : 0 } ; String NrDoc [15] Alias 332 Column ; Date DtaDoc [26] Alias 333 Column ; Bool NoteCreditoAnniPrecedenti [2] Alias 334 Hidden ; String TipoRiga [6] Alias 335 Column ; Long PNIVA_IdPNota_OLD [12] Alias 336 Hidden ; Money IgnoreAmount [23] Alias 337 Column ; Money TotIgnoreAmount = Csum (IgnoreAmount ) Alias 338 ColTotal ; Money TotCustSuppIgnoreAmount [23] = Csum (IgnoreAmount ) Alias 339 SubTotal ; Bool w_CalledFromOtherReport [1] Alias 167 Hidden Init = FALSE ; End Rules From MA_Company Select Not NULL MA_Company.CompanyName Into w_CompanyName , MA_Company.TaxIdNumber Into PartIVADichiarante ; From MA_CustSupp Select Not NULL MA_CustSupp.CustSupp Into CustSupp , MA_CustSupp.CompanyName Into CustCompanyName Where MA_CustSupp.CustSuppType == w_Custsupptype And MA_CustSupp.CustSupp Between CustSuppStart And CustSuppEnd And MA_CustSupp.CustSuppKind == { 118 : 0 } And MA_CustSupp.InTaxLists == TRUE Order By MA_CustSupp.CustSupp ; From MA_CustSuppList Select MA_CustSuppList.TaxableAmount Into TaxableAmount , MA_CustSuppList.TaxAmount Into TaxAmount , MA_CustSuppList.Exempt Into Exempt , MA_CustSuppList.CreditNotes Into CreditNotes , MA_CustSuppList.NumberOfInvoices Into NumberOfInvoices , MA_CustSuppList.NoTaxable Into NoTaxable , MA_CustSuppList.TaxAmountNotInInvoice Into TaxAmountNotInInvoice , MA_CustSuppList.TaxableAmountWithTax Into TaxableAmountWithTax Where MA_CustSuppList.CustSuppType == w_Custsupptype And MA_CustSuppList.CustSupp == CustSupp And MA_CustSuppList.BalanceYear == CurrYear And MA_CustSuppList.CreditNotes == FALSE And MA_CustSuppList.IsManual = TRUE ; From MA_JournalEntriesTax Select MA_JournalEntriesTax.TaxSign Into SegnoIVA , MA_JournalEntriesTax.CreditNotePreviousPeriod Into NoteCreditoAnniPrecedenti , MA_JournalEntriesTax.DocNo Into NrDoc , MA_JournalEntriesTax.DocumentDate Into DtaDoc , MA_JournalEntriesTax.JournalEntryId Into PNIVA_IdPNota Where ( MA_JournalEntriesTax.DocumentDate >= w_StartDate And MA_JournalEntriesTax.DocumentDate <= w_EndingDate ) And MA_JournalEntriesTax.CustSuppType == w_Custsupptype And MA_JournalEntriesTax.CustSupp == CustSupp And MA_JournalEntriesTax.Nature == NaturaDefinitiva Order By MA_JournalEntriesTax.DocumentDate, MA_JournalEntriesTax.DocNo ; From MA_JournalEntriesTaxDetail Select MA_JournalEntriesTaxDetail.Line Into PNIVAR_Riga , MA_JournalEntriesTaxDetail.TaxCode Into PNIVAR_CodIVA , MA_JournalEntriesTaxDetail.FiscalTaxableAmt Into ImponibileFiscale , MA_JournalEntriesTaxDetail.FiscalTaxAmt Into ImpostaFiscale Where MA_JournalEntriesTaxDetail.JournalEntryId = PNIVA_IdPNota ; From MA_TaxCodesLists Select MA_TaxCodesLists.CustListType Into TipoElencoClienti , MA_TaxCodesLists.SuppListType Into TipoElencoFornitori Where MA_TaxCodesLists.TaxCode == PNIVAR_CodIVA ; End Events FormFeed : Do Before Begin End After Begin Eval w_NrPage ; End Report : Do Always Begin If ( PNIVAR_CodIVA IS NOT NULL ) Then Begin If ( TipoElencoFornitori IS NULL ) Then TipoElencoFornitori = { 188 : 0 } ; If ( PNIVA_IdPNota_OLD <> PNIVA_IdPNota ) Then Begin NumberOfInvoices = 1 ; PNIVA_IdPNota_OLD = PNIVA_IdPNota ; End Else Begin NumberOfInvoices = 0 ; End ; Reset TaxableAmount ; Reset TaxAmount ; Reset NoTaxable ; Reset Exempt ; Reset TaxAmountNotInInvoice ; Reset TaxableAmountWithTax ; Reset IgnoreAmount ; If ( SegnoIVA == { 5 : 1 } ) Then Begin ImponibileFiscale = ImponibileFiscale * - 1 ; ImpostaFiscale = ImpostaFiscale * - 1 ; End ; If ( TipoElencoFornitori == { 188 : 1 } ) Then Begin TaxableAmount = ImponibileFiscale ; TaxAmount = ImpostaFiscale ; End ; If ( TipoElencoFornitori == { 188 : 2 } ) Then NoTaxable = ImponibileFiscale ; If ( TipoElencoFornitori == { 188 : 3 } ) Then Exempt = ImponibileFiscale ; If ( TipoElencoFornitori == { 188 : 4 } ) Then TaxAmountNotInInvoice = ImponibileFiscale ; If ( TipoElencoFornitori == { 188 : 5 } ) Then TaxableAmountWithTax = ImponibileFiscale ; If ( TipoElencoFornitori == { 188 : 0 } ) Then IgnoreAmount = ImponibileFiscale + ImpostaFiscale ; TotalAmount = TaxableAmount + TaxAmount + NoTaxable + Exempt + TaxAmountNotInInvoice + TaxableAmountWithTax + IgnoreAmount ; Call PrintLine ; End ; End Before Begin w_StartDate = Date ( 1 , 1 , CurrYear ) ; w_EndingDate = Date ( 31 , 12 , CurrYear ) ; End After Begin Display TotNumberOfInvoices ; Display TotTaxableAmount ; Display TotTax ; Display TotNoTaxable ; Display TotExempt ; Display TotTaxAmountNotInInvoice ; Display TotTaxableAmountWithTax ; Display TotIgnoreAmount ; Display TotTotalAmount ; End EventoCambioCliente : Breaking CustSupp Do Before Begin If ( TotCustSuppTotalAmount <> 0.0 ) Then Begin Display TotCustSuppNumberOfInvoices ; Display TotCustSuppTaxableAmount ; Display TotCustSuppTaxAmount ; Display TotCustSuppExempt ; Display TotCustSuppNoTaxable ; Display TotCustSuppTaxAmountNotInInvoice ; Display TotCustSuppTaxableAmountWithTax ; Display TotCustSuppIgnoreAmount ; Display TotCustSuppTotalAmount ; CustCompanyName = "Totale fornitore" + " " + CustSupp ; Display CustCompanyName ; NextLine ; InterLine ; End ; End After Begin Reset TotCustSuppNumberOfInvoices ; Reset TotCustSuppTaxableAmount ; Reset TotCustSuppTaxAmount ; Reset TotCustSuppExempt ; Reset TotCustSuppNoTaxable ; Reset TotCustSuppTaxAmountNotInInvoice ; Reset TotCustSuppTaxableAmountWithTax ; Reset TotCustSuppIgnoreAmount ; Reset TotCustSuppTotalAmount ; If ( CreditNotes IS NOT NULL ) Then Begin TotalAmount = TaxableAmount + TaxAmount + NoTaxable + Exempt + TaxAmountNotInInvoice + TaxableAmountWithTax + IgnoreAmount ; TotCustSuppNumberOfInvoices = NumberOfInvoices ; TotCustSuppTaxableAmount = TaxableAmount ; TotCustSuppTaxAmount = TaxAmount ; TotCustSuppExempt = Exempt ; TotCustSuppNoTaxable = NoTaxable ; TotCustSuppTaxAmountNotInInvoice = TaxAmountNotInInvoice ; TotCustSuppTaxableAmountWithTax = TaxableAmountWithTax ; TotCustSuppIgnoreAmount = IgnoreAmount ; TotCustSuppTotalAmount = TotalAmount ; End ; Call PrintFirstLine ; End End Procedures Begin Procedure PrintFirstLine Begin InterLine ; If ( TotCustSuppNumberOfInvoices == 0 and TotCustSuppTaxableAmount == 0 and TotCustSuppTaxAmount == 0 and TotCustSuppNoTaxable == 0 and TotCustSuppExempt == 0 and TotCustSuppTaxAmountNotInInvoice == 0 and TotCustSuppTaxableAmountWithTax == 0 and TotCustSuppIgnoreAmount == 0 ) Then Begin If ( PNIVA_IdPNota IS NOT NULL And PNIVA_IdPNota <> 0 ) Then Begin TipoRiga = "" ; Display CustSupp ,CustCompanyName ,TipoRiga ; End ; End Else Begin TipoRiga = "M" ; Display CustSupp ,CustCompanyName ,TipoRiga ; NumberOfInvoices = TotCustSuppNumberOfInvoices ; TaxableAmount = TotCustSuppTaxableAmount ; TaxAmount = TotCustSuppTaxAmount ; NoTaxable = TotCustSuppNoTaxable ; Exempt = TotCustSuppExempt ; TaxAmountNotInInvoice = TotCustSuppTaxAmountNotInInvoice ; TaxableAmountWithTax = TotCustSuppTaxableAmountWithTax ; IgnoreAmount = TotCustSuppIgnoreAmount ; TotalAmount = TotCustSuppTotalAmount ; Display NumberOfInvoices ; Display TaxableAmount ; Display TaxAmount ; Display NoTaxable ; Display Exempt ; Display TaxAmountNotInInvoice ; Display TaxableAmountWithTax ; Display IgnoreAmount ; Display TotalAmount ; NextLine ; Eval TotNumberOfInvoices ; Eval TotTaxableAmount ; Eval TotTax ; Eval TotNoTaxable ; Eval TotExempt ; Eval TotTaxAmountNotInInvoice ; Eval TotTaxableAmountWithTax ; Eval TotIgnoreAmount ; Eval TotTotalAmount ; End ; End Procedure PrintLine Begin If ( NumberOfInvoices <> 0 or TaxableAmount <> 0 or TaxAmount <> 0 or NoTaxable <> 0 or Exempt <> 0 or TaxAmountNotInInvoice <> 0 or IgnoreAmount <> 0 or TotalAmount <> 0 ) Then Begin If ( NoteCreditoAnniPrecedenti ) Then TipoRiga = "NV" ; Else TipoRiga = "" ; If ( NumberOfInvoices <> 0 ) Then Display DtaDoc ,NrDoc ; Display TipoRiga ,PNIVA_IdPNota ,PNIVAR_CodIVA ; TotCustSuppNumberOfInvoices = TotCustSuppNumberOfInvoices + NumberOfInvoices ; TotCustSuppTaxableAmount = TotCustSuppTaxableAmount + TaxableAmount ; TotCustSuppTaxAmount = TotCustSuppTaxAmount + TaxAmount ; TotCustSuppNoTaxable = TotCustSuppNoTaxable + NoTaxable ; TotCustSuppExempt = TotCustSuppExempt + Exempt ; TotCustSuppTaxAmountNotInInvoice = TotCustSuppTaxAmountNotInInvoice + TaxAmountNotInInvoice ; TotCustSuppTaxableAmountWithTax = TotCustSuppTaxableAmountWithTax + TaxableAmountWithTax ; TotCustSuppIgnoreAmount = TotCustSuppIgnoreAmount + IgnoreAmount ; TotCustSuppTotalAmount = TotCustSuppTotalAmount + TotalAmount ; Display NumberOfInvoices ; Display TaxableAmount ; Display TaxAmount ; Display NoTaxable ; Display Exempt ; Display TaxAmountNotInInvoice ; Display TaxableAmountWithTax ; Display IgnoreAmount ; Display TotalAmount ; NextLine ; Eval TotNumberOfInvoices ; Eval TotTaxableAmount ; Eval TotTax ; Eval TotNoTaxable ; Eval TotExempt ; Eval TotTaxAmountNotInInvoice ; Eval TotTaxableAmountWithTax ; Eval TotIgnoreAmount ; Eval TotTotalAmount ; End ; End End Dialogs Begin Dialog Selezione "Selezioni" Begin When NOT w_CalledFromOtherReport Controls Begin Begin "Fornitori" CurrYear Prompt = "Elenco dell''anno..." ; CustSuppStart Prompt = "Dal fornitore" LowerLimit HotLink ERP.CustomersSuppliers.Dbl.CustSupp ( 1 , 2 ) ; CustSuppEnd Prompt = "Al fornitore" UpperLimit HotLink ERP.CustomersSuppliers.Dbl.CustSupp ( 1 , 2 ) ; End End End End End