/
Branch-Show.php
133 lines (107 loc) · 4.02 KB
/
Branch-Show.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
include 'header.php';
$error = "";
$id=get('id');
$BranchName=get('BranchName');
$Decription=get('Decription');
$UserID = $_SESSION['UserID'];
//Update Branch
if(isset($_POST['btnSaveUpdate'])){
$txtbranchName = post('txtbranchName');
$txtDescrpiton = post('txtDescrpiton');
$update=$db->query("CALL sp_Branch_Update(
'".$id."',
N'".sql_quote($txtbranchName)."',
N'".sql_quote($txtDescrpiton)."'
)
");
if($update){
cRedirect('Branch.php');
//$error = 'Success';
}
}
?>
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Update Branch</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="panel-heading">
<?php echo $error; ?>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th>ID</th>
<th>ProductID</th>
<th>BuyPrice</th>
<th>OtherCost</th>
<th>SalePrice</th>
<th>Qty</th>
<th>QtyInstock</th>
<th>TotalBuyPrice</th>
<th>Decription</th>
</tr>
</thead>
<tbody>
<?php
$select=$db->query("SELECT
PB.ProductID AS ProductID ,
PB.BranchID AS BranchID ,
PB.BuyPrice AS BuyPrice,
PB.OtherCost AS OtherCost,
PB.SalePrice AS SalePrice,
PB.Qty AS Qty,
PB.QtyInstock AS QtyInstock,
PB.TotalBuyPrice AS TotalBuyPrice ,
PB.Decription AS Decription
FROM tblproductsbranch PB
INNER JOIN tblbranch B ON PB.BranchID=B.BranchID
WHERE B.BranchID='".$id."'
");
$rowselect=$db->dbCountRows($select);
//Call Select Product Category
if($rowselect>0){
$result="";
$i=1;
while($row=$db->fetch($select)){
$id=$row->BranchID;
$ProductID = $row->ProductID;
$BuyPrice = $row->BuyPrice;
$OtherCost=$row->OtherCost;
$SalePrice=$row->SalePrice;
$Qty=$row->Qty;
$QtyInstock=$row->QtyInstock;
$TotalBuyPrice=$row->TotalBuyPrice;
$Decription=$row->Decription;
echo'<tr class="gradeA">
<td>'.$i++.'</td>
<td>'.$ProductID.'</td>
<td>'.$BuyPrice.'</td>
<td>'.$OtherCost.'</td>
<td>'.$SalePrice.'</td>
<td>
<input name="txtQty" class="form-control" value="'.$Qty.'" required />
</td>
<td>'.$QtyInstock.'</td>
<td>'.$TotalBuyPrice.'</td>
<td>'.$Decription.'</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.row (nested) -->
</div>
<!-- /.panel-body -->
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<!-- /#page-wrapper -->