function calcCostTOWorks3( &$arTO ){ $discounts = getDiscounts(); $arWokrTypes = GetWorkTypes(); $TYPE_COST = array(); foreach( $arTO as $name=>&$TOData ){ $price = 0; $arWorksByType = array(); foreach ( $TOData["work"] as $id => &$data ){ $curdiscount = 1; if( isset ( $discounts[ $data["PROPERTY_J_SERVICE_VALUE"]] ) ){ sort( $discounts[ $data["PROPERTY_J_SERVICE_VALUE"] ] ); $curdiscount = ( 100 - current ( $discounts[ $data["PROPERTY_J_SERVICE_VALUE"] ] ))/100; } $data ["WORK_COST"] = $curdiscount * $data ["PROPERTY_J_PRICE_VALUE"] * $data ["PROPERTY_J_COUNT_VALUE"]; $price = ( float )$price + $data ["WORK_COST"]; $arWorksByType [ $data ['PROPERTY_J_SERVICE_IBLOCK_SECTION_ID'] ] = array ( "NAME" => $arWokrTypes [ $data ['PROPERTY_J_SERVICE_IBLOCK_SECTION_ID'] ], "COST"=>( $arWorksByType[ $data['PROPERTY_J_SERVICE_IBLOCK_SECTION_ID']] ["COST"] + $data ["WORK_COST"] ) ); } $TOData["COST"] = $price; $TOData["TYPE_COST"] = $arWorksByType; } }
<?php if ($isAdmin) { echo "<form method=\"post\">\n\t\t\t\t\t\t\t<center>\n\t\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Aktion:</td>\n\t\t\t\t\t\t\t<td><select name=\"delDiscountItem\" data-size=5>"; $array = getDiscounts(); foreach ($array as $d) { echo "<option value=\"" . $d[0] . "\">" . $d[1] . "</option>"; } echo "</select></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table></center>\n\t\t\t\t\t\t\t<center><input type=\"submit\" name=\"delDiscountSubmit\" class=\"btn btn-sm btn-default\" style=\"margin-top:10px;\" value=\"Löschen\" /></center>\n\t\t\t\t\t\t\t</form>"; } ?> </div> <div class="col-sm-4"> <?php if ($isAdmin) { echo "<form method=\"post\">\n\t\t\t\t\t\t\t<center><table>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>Aktion:</td>\n\t\t\t\t\t\t\t\t\t<td><select name=\"editDiscountItem\" data-size=5>"; $array = getDiscounts(); foreach ($array as $d) { echo "<option value=\"" . $d[0] . "\">" . $d[1] . "</option>"; } echo "</select></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>Neuer Name:</td>\n\t\t\t\t\t\t\t\t\t<td><input type=\"text\" class=\"form-control-nosize\" style=\"width:220px\" name=\"editDiscountName\"></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>Startdatum:</td>\n\t\t\t\t\t\t\t\t\t<td><input type=\"text\" class=\"datepicker form-control-nosize\" data-format=\"dd/mm/yyyy\" style=\"width:220px\" name=\"editDiscountBegin\"></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>Enddatum:</td>\n\t\t\t\t\t\t\t\t\t<td><input type=\"text\" class=\"datepicker form-control-nosize\" style=\"width:220px\" name=\"editDiscountEnd\"></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>Rabatt in %:</td>\n\t\t\t\t\t\t\t\t\t<td><input type=\"text\" class=\"form-control-nosize\" style=\"width:220px\" name=\"editDiscountValue\"></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table></center>\n\t\t\t\t\t\t\t<center><input type=\"submit\" name=\"editDiscountSubmit\" class=\"btn btn-sm btn-default\" style=\"margin-top:10px;\" value=\"Ersetzen\" /></center>\n\t\t\t\t\t\t\t</form>"; } ?> </div> </div> </div> </div> <div class="col-sm-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title" align="center">Kategorien</h3> </div>
</div> <div id="modalDiscount" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" hidden="hidden"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close close-modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">Descuentos</h4> </div> <div class="modal-body"> <form> <div class="form-group"> <label for="labelDiscount">Descuentos Disponibles</label> <?php getDiscounts(0); ?> </div> </form> <div id="testDiscount" class="alert alert-success" role="alert">...</div> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger close-modal">Cancelar</button> <button type="button" id="applicateDiscount" class="btn btn-primary close-modal">Aceptar</button> </div> </div> </div> </div> <div class="modal fade" id="clientModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-lg" role="document">