@@ -17,20 +17,13 @@ async function getDailyReport(e) {
1717 e . preventDefault ( ) ;
1818 const date = new Date ( dateInput . value ) ;
1919 const formattedDate = `${ date . getDate ( ) . toString ( ) . padStart ( 2 , "0" ) } -${ (
20- date . getMonth ( ) + 1
21- )
22- . toString ( )
23- . padStart ( 2 , "0" ) } -${ date . getFullYear ( ) } `;
20+ date . getMonth ( ) + 1 ) . toString ( ) . padStart ( 2 , "0" ) } -${ date . getFullYear ( ) } `;
2421
2522 let totalAmount = 0 ;
26- const res = await axios . post (
27- "http://localhost:9000/user/dailyReports" ,
28- {
29- date : formattedDate ,
30- }
31- // ,{ headers: { Authorization: token } }
23+ const res = await axios . post ( "http://localhost:9000/user/dailyReports" , { date : formattedDate }
3224 ) ;
3325
26+ // for empty the previous data
3427 tbodyDaily . innerHTML = "" ;
3528 tfootDaily . innerHTML = "" ;
3629
@@ -64,8 +57,8 @@ async function getDailyReport(e) {
6457 tr . setAttribute ( "class" , "trStyle" ) ;
6558 tfootDaily . appendChild ( tr ) ;
6659
67- const td1 = document . createElement ( "td" ) ;
68- const td2 = document . createElement ( "td" ) ;
60+ const td1 = document . createElement ( "td" ) ; // no use but make for balancing colums
61+ const td2 = document . createElement ( "td" ) ; // no use but make for balancing colums
6962 const td3 = document . createElement ( "td" ) ;
7063 const td4 = document . createElement ( "td" ) ;
7164
@@ -88,18 +81,11 @@ monthShowBtn.addEventListener("click", getMonthlyReport);
8881async function getMonthlyReport ( e ) {
8982 try {
9083 e . preventDefault ( ) ;
91- // const token = localStorage.getItem("token");
9284 const month = new Date ( monthInput . value ) ;
93- const formattedMonth = `${ ( month . getMonth ( ) + 1 )
94- . toString ( )
95- . padStart ( 2 , "0" ) } `;
85+ const formattedMonth = `${ ( month . getMonth ( ) + 1 ) . toString ( ) . padStart ( 2 , "0" ) } ` ;
9686
9787 let totalAmount = 0 ;
98- const res = await axios . post (
99- "http://localhost:9000/user/monthlyReports" ,
100- {
101- month : formattedMonth ,
102- }
88+ const res = await axios . post ( "http://localhost:9000/user/monthlyReports" , { month : formattedMonth }
10389 // ,{ headers: { Authorization: token } }
10490 ) ;
10591
0 commit comments