Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem ze zmienna w warunku smarty
danieljoz
post 28.03.2018, 23:34:34
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 3.07.2017

Ostrzeżenie: (0%)
-----


Witam mam problem z obliczaniem sumy udzielanych rabatów klientą potrzebnej do umowy

moj kod wyglada tak



Kod
{if !check_conf('privileges.hide_finances')} ({sum array=$assignments column="vdiscount"string_format=$LANGDEFS.$_language.money_format}) {/if}




lecz niestety nie wskazuje mi poprawnej wartości udzielony rabat powinien wyniesc 104 zl a jest 174 próbowałem to w ten sposób też


Kod
{if a.dateto != "0")} ({sum array=$assignments column="vdiscount"string_format=$LANGDEFS.$_language.money_format}) {/if}


struktura wyglada tak

Kod
Array
(
    [0] => Array
        (
            [id] => 528
            [tariffid] => 8
            [customerid] => 409
            [period] => miesięcznie
            [at] => 1
            [suspended] => 0
            [invoice] => 0
            [settlement] => 0
            [datefrom] => 1514329200
            [dateto] => 1530136799
            [pdiscount] => 0.00
            [vdiscount] => 68.00
            [liabilityid] => 0
            [uprate] => 8
            [upceil] => 51200
            [downceil] => 102400
            [downrate] => 8
            [type] => 1
            [relief] => 0.00
            [value] => 69.00
            [name] => internet światłowodowy 100 Mbps/50 Mbps
            [payday] => miesięcznie (1)
            [nodes] => Array
                (
                    [0] => Array
                        (
                            [name] => SAPIEJA
                            [id] => 502
                        )

                )

            [discounted_value] => 1
            [real_value] => 69.00
            [real_disc_value] => 1
            [real_downrate] => 8
            [real_downceil] => 102400
            [real_uprate] => 8
            [real_upceil] => 51200
        )

    [1] => Array
        (
            [id] => 542
            [tariffid] => 14
            [customerid] => 409
            [period] => miesięcznie
            [at] => 1
            [suspended] => 0
            [invoice] => 0
            [settlement] => 0
            [datefrom] => 1519858800
            [dateto] => 1530136799
            [pdiscount] => 0.00
            [vdiscount] => 0.00
            [liabilityid] => 0
            [uprate] => 0
            [upceil] => 0
            [downceil] => 0
            [downrate] => 0
            [type] => 10
            [relief] => 0.00
            [value] => 10.00
            [name] => multiroom tv
            [payday] => miesięcznie (1)
            [nodes] =>
            [discounted_value] => 10
            [real_value] => 10.00
            [real_disc_value] => 10
            [real_downrate] => 0
            [real_downceil] => 0
            [real_uprate] => 0
            [real_upceil] => 0
        )

    [2] => Array
        (
            [id] => 541
            [tariffid] => 12
            [customerid] => 409
            [period] => miesięcznie
            [at] => 1
            [suspended] => 0
            [invoice] => 0
            [settlement] => 0
            [datefrom] => 1521932400
            [dateto] => 1530136799
            [pdiscount] => 0.00
            [vdiscount] => 40.00
            [liabilityid] => 0
            [uprate] => 0
            [upceil] => 0
            [downceil] => 0
            [downrate] => 0
            [type] => 5
            [relief] => 0.00
            [value] => 68.00
            [name] => pakiet prestiż hd
            [payday] => miesięcznie (1)
            [nodes] =>
            [discounted_value] => 28
            [real_value] => 68.00
            [real_disc_value] => 28
            [real_downrate] => 0
            [real_downceil] => 0
            [real_uprate] => 0
            [real_upceil] => 0
        )

    [3] => Array
        (
            [id] => 545
            [tariffid] => 8
            [customerid] => 409
            [period] => miesięcznie
            [at] => 1
            [suspended] => 0
            [invoice] => 0
            [settlement] => 0
            [datefrom] => 1530136800
            [dateto] => 0
            [pdiscount] => 0.00
            [vdiscount] => 68.00
            [liabilityid] => 0
            [uprate] => 8
            [upceil] => 51200
            [downceil] => 102400
            [downrate] => 8
            [type] => 1
            [relief] => 0.00
            [value] => 69.00
            [name] => internet światłowodowy 100 Mbps/50 Mbps
            [payday] => miesięcznie (1)
            [nodes] => Array
                (
                    [0] => Array
                        (
                            [name] => SAPIEJA
                            [id] => 502
                        )

                )

            [discounted_value] => 1
        )

    [4] => Array
        (
            [id] => 546
            [tariffid] => 14
            [customerid] => 409
            [period] => miesięcznie
            [at] => 1
            [suspended] => 0
            [invoice] => 0
            [settlement] => 0
            [datefrom] => 1530136800
            [dateto] => 0
            [pdiscount] => 0.00
            [vdiscount] => 0.00
            [liabilityid] => 0
            [uprate] => 0
            [upceil] => 0
            [downceil] => 0
            [downrate] => 0
            [type] => 10
            [relief] => 0.00
            [value] => 10.00
            [name] => multiroom tv
            [payday] => miesięcznie (1)
            [nodes] =>
            [discounted_value] => 10
        )

    [5] => Array
        (
            [id] => 543
            [tariffid] => 12
            [customerid] => 409
            [period] => miesięcznie
            [at] => 1
            [suspended] => 0
            [invoice] => 0
            [settlement] => 0
            [datefrom] => 1530136800
            [dateto] => 0
            [pdiscount] => 0.00
            [vdiscount] => 0.00
            [liabilityid] => 0
            [uprate] => 0
            [upceil] => 0
            [downceil] => 0
            [downrate] => 0
            [type] => 5
            [relief] => 0.00
            [value] => 68.00
            [name] => pakiet prestiż hd
            [payday] => miesięcznie (1)
            [nodes] =>
            [discounted_value] => 68
        )

)




lecz nadal ten sam wynik mi wywala jakos moge inaczej sformuowac zapytanie ?

Ten post edytował danieljoz 28.03.2018, 23:35:36
Go to the top of the page
+Quote Post
Lion
post 29.03.2018, 17:32:10
Post #2





Grupa: Zarejestrowani
Postów: 146
Pomógł: 14
Dołączył: 23.02.2013

Ostrzeżenie: (0%)
-----


Nie rób tego w warstwie widoku, dostarcz mu te dane. Widzę że masz jakieś dane testowe więc możesz napisać prosty test jednostkowy dla nich i męczyć funkcję aż da Ci właściwy wynik. Jeśli sam napiszesz tę funkcję we właściwej warstwie łatwiej będzie Ci to debugować. Debugowanie Smarty nie należy do najprzyjemniejszych rzeczy.


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2018 - 22:36