Subversion-Projekte lars-tiefland.webanos.marine-sales.de

Revision

Revision 571 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<!-- $Id: artikel_preise.tpl 1093 2021-04-29 13:50:56Z tiefland $ BEGIN -->
    <tr>
        <td class="links">
            <b>Preise</b>
        </td>
        <td>
            {assign var=Feld value="preise"}
            <style>
                body
                {
                    font-family: verdana, Helvetica, sans-serif;
                    font-size: 10pt;
                }
            </style>
            {for $i=1;$i<$preis_anz;$i++}
                <div id="reiter{$i}" class="reiter">
                    <ul>
                        <li>
                            {assign var="preisLabel" value=";"|explode: $preise[$i]}
                            <a href="#preis{$i}">{$preisLabel[0]|default:"Preis {$i}"}</a>
                        </li>
                        {if isset($web_rechte.online_shop.artikel.preisstaffel)}
                            <li>
                                <a href="#staffel{$i}">Staffel {$preisLabel[0]|default:"Preis {$i}"}</a>
                            </li>
                        {/if}
                    </ul>
                    <div id="preis{$i}">
                        <table>
                            <tr>
                                <td>{$preisLabel[0]}:</td>
                                <td>neuer Preis:</td>
                                <td>neuer Preis g&uuml;ltig ab:</td>
                                <td>neuer Preis g&uuml;ltig bis:</td>
                            </tr>
                            <tr>
                                <td>
                                    {if !in_array("preise",$gesperrte_felder) || !$zeile.mutter}
                                        <input type="text" {if $cfg[$i]["Brutto_Netto_Rechner"]==1}class="Brutto_Netto_Rechner_Basis"{/if} id="staffel_{$i}_preis_0" name="staffel[{$i}][preis][0]" value="{$item->price[$i-1]->preis}" data-calc-preis="{$preis[$i].preis_calc[0]}" />
                                        <input type="hidden" name="staffel[{$i}][menge][0]" value="0" />
                                    {else}
                                        <div {if $cfg[$i]["Brutto_Netto_Rechner"]==1}class="Brutto_Netto_Rechner_Basis"{/if} id="staffel_{$i}_preis_0" data-calc-preis="{$preis[$i].preis_calc[0]}">{$preis[$i].preis[0]}</div>
                                    {/if}
                                    {if $cfg[$i]["Preiskalkulation"]==1}
                                        <a id="calc" data-preis-index="{$i}"></a>
                                    {/if}
                                    {if $cfg[$i]["Brutto_Netto_Rechner"]==1}
                                        <br />Nettopreis:
                                        <span class="veraenderter_Brutto_Netto_Rechner_staffel_{$i}_preis_0">&nbsp;</span>
                                    {/if}
                                </td>
                                <td>
                                    {if !in_array("preise",$gesperrte_felder) || !$zeile.mutter}
                                        <input type="text" id="staffel_{$i}_preisneu_0" name="staffel[{$i}][preisneu][0]" value="{$preis[$i].preisneu[0]}" />
                                    {else}
                                        <div>{$preis[$i].preisneu[0]}</div>
                                    {/if}
                                </td>
                                <td>
                                    {if !in_array("preise",$gesperrte_felder) || !$zeile.mutter}
                                        <input class="datefrom" type="date" id="staffel_{$i}_datefrom_0" name="staffel[{$i}][datefrom][0]" value="{$preis[$i].datefrom[0]}" data-default="{$smarty.session["artikel.php"].datefrom[0]}" />
                                    {else}
                                        <div>{$preis[$i].datefrom[0]}</div>
                                    {/if}
                                </td>
                                <td>
                                    {if !in_array("preise",$gesperrte_felder) || !$zeile.mutter}
                                        <input type="date" id="staffel_{$i}_dateto_0" name="staffel[{$i}][dateto][0]" value="{$preis[$i].dateto[0]}" />
                                    {else}
                                        <div>{$preis[$i].dateto[0]}</div>
                                    {/if}
                                </td>
                            </tr>
                        </table>
                        {if $preis[$i].geaendert_am}
                            <br />
                            geändert: {$preis[$i].geaendert_am|date_format:"d.m.Y H:i:s"}
                        {/if}
                    </div>
                    {if isset($web_rechte.online_shop.artikel.preisstaffel)}
                        <div id="staffel{$i}" class="staffel">
                            <table id="table_staffel_{$i}">
                                {foreach $preis[$i].menge as $nr => $wert}
                                    {if $nr ne 0}
                                        <tr id="tr_staffel_{$i}_{$nr}" class="tr_staffel_{$i}">
                                            <td>
                                                ab:
                                                <input type="text" name="staffel[{$i}][menge][]" value="{$wert}"/>
                                            </td>
                                            <td>
                                                Preis:
                                                <input type="text" name="staffel[{$i}][preis][]" value="{$preis[$i].preis[$nr]}" />
                                            </td>
                                            <td>
                                                neuer Preis:
                                                <input type="text" name="staffel[{$i}][preisneu][]" value="{$preis[$i].preisneu[$nr]}" />
                                            </td>
                                            <td>
                                                neuer Preis g&uuml;ltig ab:
                                                <input class="datefrom" type="date" name="staffel[{$i}][datefrom][]" value="{$preis[$i].datefrom[$nr]}" data-default="{$smarty.session["artikel.php"].datefrom[0]}" />
                                            </td>
                                            <td>
                                                neuer Preis g&uuml;ltig bis:
                                                <input type="date" name="staffel[{$i}][dateto][]" value="{$preis[$i].dateto[$nr]}" />
                                            </td>
                                            <td>
                                                <img src="../dokumente/gfx/delete_record.gif" style="cursor:pointer" id="del_staffel_{$i}_{$nr}" class="delete"/>
                                            </td>
                                        </tr>
                                    {/if}
                                {/foreach}
                            </table>
                            <span>
            <img src="../dokumente/gfx/add.gif" style="cursor:pointer" id="new_staffel_{$i}"/>
        </span>
                        </div>
                    {/if}
                </div>
            {/for}
            <script>
                $(function()
                {
                    {for $i=1;$i<$preis_anz;$i++}
                    $('#reiter'+{$i}).tabs();
                    $('#new_staffel_'+{$i}).click(add_staffel);
                    $('.delete').click(del_staffel);
                    {if $cfg[$i]["Brutto_Netto_Rechner"]==1}
                    $('#staffel_{$i}_preis_0').change(Brutto_Netto_Rechner_Single);
                    {/if}
                    {/for}
                    $('#tax1').change(Brutto_Netto_Rechner).change();
                });
                function add_staffel()
                {
                    arr=this.id.split('_');
                    nr=arr[2];
                    elems=$('.tr_staffel_'+nr).length;
                    next_id=Math.abs(elems+1);
                    arr[0]="table";
                    table_id=arr.join('_');
                    del_id='del_staffel_'+nr+'_'+next_id;
                    r_html='<tr id="tr_staffel_'+nr+'_'+next_id+'" class="tr_staffel_'+nr+'"><td>ab: <input type="text" name="staffel['+nr+'][menge][]" value=""></td><td>Preis: <input type="text" name="staffel['+nr+'][preis][]" value="" onkeyup="killkomma_neu(this);" onblur="this.value=killkomma(this.value);"></td><td>neuer Preis: <input type="text" name="staffel['+nr+'][preisneu][]" value="" onkeyup="killkomma_neu(this);" onblur="this.value=killkomma(this.value);"></td><td>neuer Preis g&uml;ltig ab:<input type="date" name="staffel['+nr+'][datefrom][]" value="" /></td><td>neuer Preis g&uml;ltig bis:<input type="date" name="staffel['+nr+'][dateto][]" value="" /></td><td><img src="../dokumente/gfx/delete_record.gif" style="cursor:pointer" id="'+del_id+'" class="delete"></td></tr>';
                    $('#'+table_id).append(r_html);
                    $('#'+del_id).click(del_staffel);
                }

                function del_staffel()
                {
                    arr=this.id.split('_');
                    arr[0]="tr";
                    tr_id=arr.join('_');
                    $('#'+tr_id).remove();
                }
                function Brutto_Netto_Rechner(){
                    $(".Brutto_Netto_Rechner_Basis").each(Brutto_Netto_Rechner_Single);
                }

                function Brutto_Netto_Rechner_Single()
                {
                    mwstString=$("#tax1 :selected").text();
                    var mwst;
                    if(mwstString.toString().indexOf("%") != -1){
                        mwst = mwstString.split("%");
                        mwst = mwst[0];
                    }else{
                        mwst = mwstString;
                    }
                    mwst = mwst.trim();
                    name = $(this).attr("id");
                    value = $(this).val();

                    className="veraenderter_Brutto_Netto_Rechner_"+name;
                    url="/Online-Shop/errechneNettoPreis.php?preis="+value+"&mwst="+mwst;
                    $.ajax({
                        "async" :false,
                        "url":url,
                        "success":function(html){
                            $('.'+className).html(html);
                        },
                    });
                }
            </script>
            {assign var=Feld2 value= "tax1"}
            {if ( isset( $user_rechte[$smarty.const.modul_name][$smarty.const.tool_name][$Feld2] ) )}
            <br />
            Steuersatz:
            {if in_array( strtolower( $Feld ), $gesperrte_felder ) && $zeile["mutter"]}
                {$taxArr[$zeile["tax1"]]}
            {else}
            {html_options name="tax1" options=$taxArr selected=$zeile.tax1 id="tax1"}
            {/if}
            {/if}
        </td>
    </tr>
<script>
    $(function(){
        $('#calc').button({
            icons:{
                primary:"ui-icon-calculator"
            }
        }).click(show_min_price_dlg);
        $('.datefrom').focus(function(){
            if(!$(this).val())
            {
                $(this).val($(this).attr("data-default"));
            }
        })
        $('#min_price_dlg').dialog({
            autoOpen:false,
            modal:true,
            resizable:false,
            width:400,
            buttons:[
                {
                    text:"berchnen",
                    icons: {
                        primary: "ui-icon-calculator"
                    },
                    click:function()
                    {
                        calc_min_price();
                    }
                },
                {
                    text:"speichern",
                    icons: {
                        primary: "ui-icon-check"
                    },
                    click:function()
                    {
                        daten={
                            minPreis:$('#mindestpreis').val(),
                            artikel:$('#a_id').val(),
                            pIndex:$('#pIndex').val()
                        }
                        $.post("save_min_price.php",daten);
                        document.location.href="artikel.php?action=edit&ID="+$('#a_id').val();
                        $(this).dialog("close");
                    }
                },
                {
                    text:"verwerfen",
                    icons:{
                        primary:"ui-icon-close"
                    },
                    click:function()
                    {
                        $(this).dialog("close");
                    }
                }]

        })
    })

    function calc_min_price()
    {
        daten={
            ek:$('#ek').val(),
            nachlass1:$('#nachlass1').val(),
            nachlass2:$('#nachlass2').val(),
            nachlass3:$('#nachlass3').val(),
            skonto:$('#skonto').val(),
            zuschlag:$('#zuschlag').val()
        }
        $.post("calc_min_price.php",daten,function(html)
        {
            $('#mindestpreis').val(html);
        });
    }

    function show_min_price_dlg()
    {
        pId=$(this).attr("data-preis-index");
        $('#pIndex').val(pId)
        $('#min_price_dlg').dialog("open");
    }
</script>
<div id="min_price_dlg" title="Mininmalpreis berechnen">
    <table>
        <tr>
            <td>Einkaufspreis (netto)</td>
            <td>
                <input type="text" id="ek" />
            </td>
        </tr>
        <tr>
            <td>Nachlass 1 (%)</td>
            <td>
                <input type="number" id="nachlass1" min="0" max="100" class="input" />
            </td>
        </tr>
        <tr>
            <td>Nachlass 2 (%)</td>
            <td>
                <input type="number" id="nachlass2" value="" min="0" max="100" class="input" />
            </td>
        </tr>
        <tr>
            <td>Nachlass 3 (%)</td>
            <td>
                <input type="number" id="nachlass3" value="" min="0" max="100" class="input" />
            </td>
        </tr>
        <tr>
            <td>Skonto (%)</td>
            <td>
                <input type="number" id="skonto" value="" min="0" max="100" class="input" />
            </td>
        </tr>
        <tr>
            <td>Zuschlag (%)</td>
            <td>
                <input type="number" value="" id="zuschlag" min="0" max="100" class="input" />
            </td>
        </tr>
        <tr>
            <td>Ergebnis</td>
            <td>
                <input type="text" id="mindestpreis" value="" readonly="readonly" disabled="disabled" />
            </td>
        </tr>
    </table>
    <input type="hidden" id="pIndex" />
</div>
<!-- $Id: artikel_preise.tpl 1093 2021-04-29 13:50:56Z tiefland $ END -->