constthisLast=newDate(year,month+1,0);//이번 달의 마지막 날
constthisLast=newDate(year,month+1,0);
constdb=awaitgetDb();
constdb=awaitgetDb();
returnnewPromise((res,rej)=>{
returnnewPromise((res,rej)=>{
db.transaction(async(tx)=>{
db.transaction(async(tx)=>{
console.log('월간 데이터');
const[txn,results]=awaittx.executeSql(`SELECT date, type_id, sum(price) as total from money where date BETWEEN "${getDateStr(thisFirst)}" and "${getDateStr(thisLast)}" group by date, type_id`);
const[txn,results]=awaittx.executeSql(`SELECT date, type_id, sum(price) as total from money where date BETWEEN "${String(thisFirst.toJSON()).split(/T/)[0]}" and "${String(thisLast.toJSON()).split(/T/)[0]}" group by date, type_id`);
constthisLast=newDate(year,month+1,0);//이번 달의 마지막 날
constthisLast=newDate(year,month+1,0);
constdb=awaitgetDb();
constdb=awaitgetDb();
returnnewPromise((res,rej)=>{
returnnewPromise((res,rej)=>{
db.transaction(async(tx)=>{
db.transaction(async(tx)=>{
console.log('차트 페이지');
const[txn,results]=awaittx.executeSql(`SELECT category_id, category_name, sum(price) as total from (SELECT money.type_id, price, money.category_id, category_name FROM money inner JOIN categories on money.category_id = categories.category_id where date BETWEEN "${getDateStr(thisFirst)}" and "${getDateStr(thisLast)}") WHERE type_id=2 group by category_id`);
const[txn,results]=awaittx.executeSql(`SELECT category_id, category_name, sum(price) as total from (SELECT money.type_id, price, money.category_id, category_name FROM money inner JOIN categories on money.category_id = categories.category_id where date BETWEEN "${getDate(thisFirst)}" and "${getDate(thisLast)}") WHERE type_id=2 group by category_id`);
const[txn,results]=awaittx.executeSql(`SELECT strftime('%m',date) as month, type_id, sum(price) as total from money where strftime('%Y', date)= "${year}" GROUP by strftime('%m', date), type_id `);
const[txn,results]=awaittx.executeSql(`SELECT strftime('%m',date) as month, type_id, sum(price) as total from money where strftime('%Y', date)= "${year}" GROUP by strftime('%m', date), type_id `);