A tool
by iAbdullah95
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>A tool</title>
<meta name="description" content="A tool">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="footer-distributed-with-address-and-phones.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<link href="http://fonts.googleapis.com/css?family=Cookie" rel="stylesheet" type="text/css">
</head>
<body>
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#1" aria-controls="1" role="tab" data-toggle="tab">تعديل السهم</a></li>
<li role="presentation"><a href="#2" aria-controls="2" role="tab" data-toggle="tab">الربح المستهدف</a></li>
</ul>
</div>
<h1>أداة تعديل متوسط التكلفة للسهم</h1>
<h3>Input from user</h3>
<label>التكلفة القديمة</label><input type="text" id="oldCost" /><br>
<label>الكمية القديمة</label><input type="text" id="oldQuantity" /><br><br>
<label>التكلفة الجديدة</label><input type="text" id="newCost" /><br>
<label>الكمية الجديدة</label><input type="text" id="newQuantity" /><br>
<h3>Output</h3>
<button onclick="cacl()">احسب</button><br><br>
<label>السعر الجديد المعدل: </label><div id="Calculate"></div>
<h4>note:</h4>
<p><b>السعر الجديد المعدل = (التكلفة القديمة + التكلفة الجديدة) / (الكمية القديمة + الكمية الجديدة)</b></p>
<!-- JavaScript -->
<script src="main.js"></script>
</body>
</html>
CSS
html {
background: #e6e9e9;
background-image: linear-gradient(270deg, rgb(230, 233, 233) 0%, rgb(216, 221, 221) 100%);
-webkit-font-smoothing: antialiased;
}
body {
direction: rtl;
background: #fff;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
color: #545454;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
margin: 0 auto;
max-width: 800px;
padding: 2em 2em 4em;
}
h1, h2, h3, h4, h5, h6 {
color: #222;
font-weight: 600;
line-height: 1.3;
}
h2 {
margin-top: 1.3em;
}
a {
color: #0083e8;
}
b, strong {
font-weight: 600;
}
input {
margin: 5px;
}
samp {
display: none;
}
img {
animation: colorize 2s cubic-bezier(0, 0, .78, .36) 1;
background: transparent;
border: 10px solid rgba(0, 0, 0, 0.12);
border-radius: 4px;
display: block;
margin: 1.3em auto;
max-width: 95%;
}
@keyframes colorize {
0% {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
100% {
-webkit-filter: grayscale(0%);
filter: grayscale(0%);
}
}
JavaScript
/* global document console, alert, prompt */
var oldPrice_input = document.getElementById("oldPrice").value, // السعر القديم
oldQuantity_input = document.getElementById("oldQuantity").value, // اجعلها عدد صحيح لا يقبل الفواصل لأنها كمية
oldCost_input = document.getElementById("oldCost").value,
newPrice_input = document.getElementById("newPrice").value, // السعر الجديد
newQuantity_input = document.getElementById("newQuantity").value, // اجعلها عدد صحيح لا يقبل الفواصل لأنها كمية
newCost_input = document.getElementById("newCost").value,
oldPrice_output = oldCost_input / oldQuantity_input, // السعر القديم
newPrice_indep_output = newCost_input / newQuantity_input, // السعر الجديد المستقل
TotalQuantity_output = oldQuantity_input + newQuantity_input, // إجمالي الكمية
TotalCost_output = oldCost_input + newCost_input, // إجمالي التكلفة
newPrice_output = TotalCost_output / TotalQuantity_output, // السعر المعدل الجديد
VAT = 0.05, // ضريبة القيمة المضافة
Bank_Commision = 0.00105, // نصيب البنك من عمولة الأوامر
Tadawul_Commision = 0.00018, // نصيب تداول من عمولة الأوامر
CMA_Commision = 0.00032, // نصيب هيئة سوق المال من عمولة الأوامر
full_Commision = Bank_Commision + Tadawul_Commision + CMA_Commision, // مجموع عمولة الأوامر
Commision_with_VAT = (1 + VAT) * (Bank_Commision + Tadawul_Commision); // قيمة العمولة التي تشملها الضريبة مضافاً إليها الضريبة
function cacl() {
"use strict";
document.getElementById("Calculate").innerHTML = parseInt(newPrice_output);
}