Skip to content

Commit

Permalink
All Filter options working except Group filter
Browse files Browse the repository at this point in the history
  • Loading branch information
KaushikOP committed Jul 17, 2021
1 parent db276a2 commit c2d8622
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 74 deletions.
65 changes: 37 additions & 28 deletions DB/casystem.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 11, 2021 at 12:23 PM
-- Generation Time: Jul 15, 2021 at 05:08 PM
-- Server version: 10.4.20-MariaDB
-- PHP Version: 8.0.8

Expand Down Expand Up @@ -41,13 +41,17 @@ CREATE TABLE `bill_details` (
--

INSERT INTO `bill_details` (`bill_details_id`, `bill_master_id`, `firm_id`, `service_id`, `taxable_amount`, `tax_amount`) VALUES
(1, '0', 3, 4, 1000, 1180),
(2, '0', 3, 1, 2000, 2360),
(3, '1', 3, 4, 2000, 2360),
(4, '1', 3, 1, 3029, 3574.22),
(5, '1', 3, 2, 450, 531),
(6, '0', 1, 9, 1000, 0),
(7, '0', 1, 10, 2000, 0);
(1, '2021-22/0', 3, 4, 1000, 1180),
(2, '2021-22/0', 3, 1, 2000, 2360),
(3, '2021-22/1', 3, 4, 2000, 2360),
(4, '2021-22/1', 3, 1, 3029, 3574.22),
(5, '2021-22/1', 3, 2, 450, 531),
(6, '2021-22/0', 1, 9, 1000, 0),
(7, '2021-22/0', 1, 10, 2000, 0),
(8, '2021-22/1', 1, 10, 1000, 0),
(9, '2021-22/1', 1, 8, 2092, 0),
(10, '2021-22/2', 3, 5, 1209, 1426.62),
(11, '2021-22/2', 3, 2, 3448, 4068.64);

-- --------------------------------------------------------

Expand Down Expand Up @@ -75,9 +79,11 @@ CREATE TABLE `bill_master` (
--

INSERT INTO `bill_master` (`invoice_no`, `firm_id`, `invoice_date`, `client_id`, `total_amount`, `amount_received`, `receipt_date`, `payment_mode`, `cheque_no`, `amount_pending`, `tds`, `state_code`) VALUES
('0', 1, '2021-07-01', 3, 3000, 0, '0000-00-00', '0', '0', '0', 0, NULL),
('0', 3, '2021-07-02', 1, 3540, 0, '0000-00-00', '0', '0', '0', 0, 27),
('1', 3, '2021-04-09', 4, 6465.22, 0, '0000-00-00', '0', '0', '0', 0, 24);
('2021-22/0', 1, '2021-07-01', 3, 3000, 0, '0000-00-00', '0', '0', '0', 0, NULL),
('2021-22/0', 3, '2021-07-02', 1, 3540, 0, '0000-00-00', '0', '0', '0', 0, 27),
('2021-22/1', 1, '2021-07-01', 1, 3092, 0, '0000-00-00', '0', '0', '0', 0, NULL),
('2021-22/1', 3, '2021-04-09', 4, 6465.22, 0, '0000-00-00', '0', '0', '0', 0, 24),
('2021-22/2', 3, '2021-03-16', 4, 5495.26, 0, '0000-00-00', '0', '0', '0', 0, 24);

-- --------------------------------------------------------

Expand All @@ -89,18 +95,19 @@ CREATE TABLE `clientlist` (
`clientId` int(11) NOT NULL,
`clientName` text NOT NULL,
`GST` varchar(15) NOT NULL,
`clientAddress` longtext DEFAULT NULL
`clientAddress` longtext DEFAULT NULL,
`mobile_no` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `clientlist`
--

INSERT INTO `clientlist` (`clientId`, `clientName`, `GST`, `clientAddress`) VALUES
(1, 'REAL LAMINATES\r\n\r\n', '27AAFFR1902F1ZJ', 'Plot No. 13, New Timber Market, Bhawani Peth, Pune 411 002.\r\n'),
(2, 'B. U. BHANDARI VAASTU\r\n', '27AAHFB1197Q1ZV', ''),
(3, 'B. U. BHANDARI ERANDWANA (AOP)\r\n', '27AACAB9561G1ZN', ''),
(4, 'SANKET IMPEX\r\n', '27AOIPB9142E1Z4', '1ST FLOOR, SAMRAT HOUSE, 39 - D, 2/6, SHANKARSETH ROAD PUNE - 411037\r\n');
INSERT INTO `clientlist` (`clientId`, `clientName`, `GST`, `clientAddress`, `mobile_no`) VALUES
(1, 'REAL LAMINATES', '27AAFFR1902F1ZJ', 'Plot No. 13, New Timber Market, Bhawani Peth, Pune 411 002.', '1234567795'),
(2, 'B. U. BHANDARI VAASTU', '27AAHFB1197Q1ZV', 'Gandhinagar', ''),
(3, 'B. U. BHANDARI ERANDWANA (AOP)', '27AACAB9561G1ZN', '', '9876543211'),
(4, 'SANKET IMPEX\r\n', '27AOIPB9142E1Z4', '1ST FLOOR, SAMRAT HOUSE, 39 - D, 2/6, SHANKARSETH ROAD PUNE - 411037\r\n', '');

-- --------------------------------------------------------

Expand All @@ -110,17 +117,18 @@ INSERT INTO `clientlist` (`clientId`, `clientName`, `GST`, `clientAddress`) VALU

CREATE TABLE `firmname` (
`firmNameId` int(11) NOT NULL,
`name` text NOT NULL
`name` text NOT NULL,
`shortForm` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `firmname`
--

INSERT INTO `firmname` (`firmNameId`, `name`) VALUES
(1, 'jinal Waghela & Associates'),
(2, 'MoneySphere Solutions'),
(3, 'H. Mistry & Associates');
INSERT INTO `firmname` (`firmNameId`, `name`, `shortForm`) VALUES
(1, 'jinal Waghela & Associates', 'JWA'),
(2, 'MoneySphere Solutions', 'MSP'),
(3, 'H. Mistry & Associates', 'HMA');

-- --------------------------------------------------------

Expand Down Expand Up @@ -195,16 +203,17 @@ CREATE TABLE `services` (
--

INSERT INTO `services` (`serviceId`, `serviceName`, `serviceDescription`, `SAC`, `firmNameId`) VALUES
(1, 'Legal advisory and representation services concerning other fields of law\r\n', 'Legal advisory\r\n', 998212, 3),
(1, 'Legal advisory and representation services concerning other fields of law', 'Legal advisory', 998212, 3),
(2, 'Legal documentation and certification services concerning other documents\r\n', 'Certification Fees\r\n', 998214, 3),
(3, 'Other legal services\r\n', 'Other legal services\r\n', 998216, 3),
(4, 'Financial auditing services\r\n', 'Audit Fees\r\n', 998221, 3),
(5, 'Accounting and bookkeeping service\r\n', 'Accounting and Bookkeeping\r\n', 998222, 3),
(6, '', 'Audit Fees', 0, 1),
(6, 'Audit Fees for JWA', 'Audit Fees', 234, 1),
(7, '', 'E - TDS RETURN FILING FEES\r\n', 0, 1),
(8, '', 'INCOME TAX RETURN FILING FEES\r\n', 0, 1),
(9, '', 'ACCOUNTING/BOOK KEEPING FEES\r\n', 0, 1),
(10, '', 'GST RETURN FILING FEES\r\n', 0, 1);
(10, '', 'GST RETURN FILING FEES\r\n', 0, 1),
(11, 'Test Service', 'This is a test service', 123456, 2);

--
-- Indexes for dumped tables
Expand Down Expand Up @@ -261,13 +270,13 @@ ALTER TABLE `services`
-- AUTO_INCREMENT for table `bill_details`
--
ALTER TABLE `bill_details`
MODIFY `bill_details_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
MODIFY `bill_details_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `clientlist`
--
ALTER TABLE `clientlist`
MODIFY `clientId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
MODIFY `clientId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `firmname`
Expand All @@ -285,7 +294,7 @@ ALTER TABLE `gst_state_code_list`
-- AUTO_INCREMENT for table `services`
--
ALTER TABLE `services`
MODIFY `serviceId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
MODIFY `serviceId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- Constraints for dumped tables
Expand Down
121 changes: 76 additions & 45 deletions Receivables.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@

<script>
$(document).ready(function () {


$("#fYear").val(getFinancialYear());


function getFinancialYear(){
var fiscalyear = "";
var today = new Date();
if ((today.getMonth() + 1) <= 3) {
fiscalyear = (today.getFullYear() - 1) + "-" + (''+today.getFullYear()).substr(2);
} else {
fiscalyear = today.getFullYear() + "-" + (''+(today.getFullYear() + 1)).substr(2);
}
return fiscalyear;
}


$("#filterDiv").click(function () {
$("#filter").toggle(1200, "swing");
});
Expand All @@ -63,6 +80,12 @@
return;
}

if($("#fYear").val().length<7){
alert("Please select proper Fiscal Year...");
$("#fYear").val(getFinancialYear());
return;
}

if ($("#firm1").prop("checked")) {
firm1 = $("#firm1").val();
}
Expand All @@ -79,6 +102,12 @@
})
.data("id");

var fiscalYear = $("#fYear").val();
if(fiscalYear == "All Years"){
fiscalYear = 0;
}


$.ajax({
url: "filterReceivables.php", // your php file
type: "POST", // type of the HTTP request
Expand All @@ -87,6 +116,7 @@
firm2: firm2,
firm3: firm3,
clientId: clientId,
fiscalYear: fiscalYear,
},
success: function (result) {
if (result) {
Expand Down Expand Up @@ -199,15 +229,15 @@ <h6>Filter Options</h6>
<div class="row col-12 form-group">
<h5 class="col-1">Select Firm:</h5>
<div class="form-check col-2 form-check-inline">
<input class="form-check-input" type="checkbox" id="firm1" name="firm1" value="1" />
<input class="form-check-input" type="checkbox" id="firm1" name="firm1" value="1" checked/>
<label class="form-check-label" for="firm2">Jinal Waghela & Associates</label>
</div>
<div class="form-check col-2 form-check-inline">
<input class="form-check-input" type="checkbox" id="firm2" name="firm2" value="2" />
<input class="form-check-input" type="checkbox" id="firm2" name="firm2" value="2" checked/>
<label class="form-check-label" for="firm3">MoneySphere Solutions</label>
</div>
<div class="form-check col-2 form-check-inline">
<input class="form-check-input" type="checkbox" id="firm3" name="firm3" value="3" />
<input class="form-check-input" type="checkbox" id="firm3" name="firm3" value="3" checked/>
<label class="form-check-label" for="firm1">H Mistry & Associates</label>
</div>
<div class="col-4 row">
Expand Down Expand Up @@ -245,57 +275,58 @@ <h5 class="text-right">Select Financial Year:</h5>
list="fYearList" placeholder="Select Financial Year" />

<datalist id="fYearList">
<option data-id="1" selected>2000-01</option>
<option data-id="2" selected>2001-02</option>
<option data-id="3" selected>2002-03</option>
<option data-id="4" selected>2003-04</option>
<option data-id="5" selected>2004-05</option>
<option data-id="6" selected>2005-06</option>
<option data-id="7" selected>2006-07</option>
<option data-id="8" selected>2007-08</option>
<option data-id="9" selected>2008-09</option>
<option data-id="10" selected>2009-10</option>
<option data-id="11" selected>2010-11</option>
<option data-id="12" selected>2011-12</option>
<option data-id="13" selected>2012-13</option>
<option data-id="14" selected>2013-14</option>
<option data-id="15" selected>2014-15</option>
<option data-id="16" selected>2015-16</option>
<option data-id="17" selected>2016-17</option>
<option data-id="18" selected>2017-18</option>
<option data-id="19" selected>2018-19</option>
<option data-id="20" selected>2019-20</option>
<option data-id="21" selected>2020-21</option>
<option data-id="22" selected>2021-22</option>
<option data-id="23" selected>2022-23</option>
<option data-id="24" selected>2023-24</option>
<option data-id="25" selected>2024-25</option>
<option data-id="26" selected>2026-27</option>
<option data-id="27" selected>2027-28</option>
<option data-id="28" selected>2028-29</option>
<option data-id="29" selected>2029-30</option>
<option data-id="30" selected>2030-31</option>
<option data-id="31" selected>2031-32</option>
<option data-id="32" selected>2032-33</option>
<option data-id="33" selected>2033-34</option>
<option data-id="34" selected>2034-35</option>
<option data-id="35" selected>2035-36</option>
<option data-id="36" selected>2036-37</option>
<option data-id="37" selected>2037-38</option>
<option data-id="38" selected>2038-39</option>
<option data-id="39" selected>2039-40</option>
<option data-id="40" selected>2040-41</option>
<option data-id="0" >All Years</option>
<option data-id="1" >2000-01</option>
<option data-id="2" >2001-02</option>
<option data-id="3" >2002-03</option>
<option data-id="4" >2003-04</option>
<option data-id="5" >2004-05</option>
<option data-id="6" >2005-06</option>
<option data-id="7" >2006-07</option>
<option data-id="8" >2007-08</option>
<option data-id="9" >2008-09</option>
<option data-id="10" >2009-10</option>
<option data-id="11" >2010-11</option>
<option data-id="12" >2011-12</option>
<option data-id="13" >2012-13</option>
<option data-id="14" >2013-14</option>
<option data-id="15" >2014-15</option>
<option data-id="16" >2015-16</option>
<option data-id="17" >2016-17</option>
<option data-id="18" >2017-18</option>
<option data-id="19" >2018-19</option>
<option data-id="20" >2019-20</option>
<option data-id="21" >2020-21</option>
<option data-id="22" >2021-22</option>
<option data-id="23" >2022-23</option>
<option data-id="24" >2023-24</option>
<option data-id="25" >2024-25</option>
<option data-id="26" >2026-27</option>
<option data-id="27" >2027-28</option>
<option data-id="28" >2028-29</option>
<option data-id="29" >2029-30</option>
<option data-id="30" >2030-31</option>
<option data-id="31" >2031-32</option>
<option data-id="32" >2032-33</option>
<option data-id="33" >2033-34</option>
<option data-id="34" >2034-35</option>
<option data-id="35" >2035-36</option>
<option data-id="36" >2036-37</option>
<option data-id="37" >2037-38</option>
<option data-id="38" >2038-39</option>
<option data-id="39" >2039-40</option>
<option data-id="40" >2040-41</option>
</datalist>
</div>
<div class="col-2 text-right">
<h5>Select Client Group:</h5>
</div>
<div class="col-3">
<input type="text" id="clientGrp" name="clientGrp" class="form-control" aria-label="Default select example"
list="clientGrpList" placeholder="Select Client Group" />
list="clientGrpList" placeholder="Select Client Group: Coming Soon..." />

<datalist id="clientGrpList">
<option data-id="0" selected>Client Groups</option>
<option data-id="0" selected>Coming Soon...</option>
</datalist>
</div>
<div class="col-2"></div>
Expand Down
21 changes: 20 additions & 1 deletion filterReceivables.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,31 @@
require_once "connect.php";

if(isset($_POST)){

$clientIdStr=" and cl.clientId=".$_POST['clientId'];
$fiscalYearStr="and bm.invoice_no LIKE '".$_POST['fiscalYear']."%'";

if($_POST['clientId'] == 0){
$clientIdStr=" and cl.clientId>0";
}

if($_POST['fiscalYear'] == 0){
$fiscalYearStr=" and bm.invoice_no LIKE '%'";
}

$query = "select * from bill_master bm inner join clientlist cl inner join firmname fn on bm.firm_id = fn.firmNameId and bm.client_id = cl.clientId where (fn.firmNameId=".$_POST['firm3']." or fn.firmNameId=".$_POST['firm2']." or fn.firmNameId=".$_POST['firm1'].")".$clientIdStr.$fiscalYearStr;
echo $query;
}



/*if(isset($_POST)){
if($_POST['clientId'] == 0){
$query = "select * from bill_master bm inner join clientlist cl inner join firmname fn on bm.firm_id = fn.firmNameId and bm.client_id = cl.clientId where (fn.firmNameId=".$_POST['firm3']." or fn.firmNameId=".$_POST['firm2']." or fn.firmNameId=".$_POST['firm1'].") and cl.clientId>0";
}
else{
$query = "select * from bill_master bm inner join clientlist cl inner join firmname fn on bm.firm_id = fn.firmNameId and bm.client_id = cl.clientId where (fn.firmNameId=".$_POST['firm3']." or fn.firmNameId=".$_POST['firm2']." or fn.firmNameId=".$_POST['firm1'].") and cl.clientId=".$_POST['clientId'];
}
echo $query;
}
}*/
?>

0 comments on commit c2d8622

Please sign in to comment.