Skip to content

Commit

Permalink
Merge pull request #1 from derektruong/DoAnDUT
Browse files Browse the repository at this point in the history
Do an dut
  • Loading branch information
derektruong committed Jan 22, 2021
2 parents 9063b60 + a22c67b commit be60091
Show file tree
Hide file tree
Showing 23 changed files with 524 additions and 578 deletions.
22 changes: 11 additions & 11 deletions QuanLyChiTieu/adduser.ui
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ background-color: rgb(255, 119, 137,0);</string>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 2px solid gray;
border-radius: 10px;
border-radius: 7px;
font: 12pt &quot;Segoe UI&quot;;</string>
</property>
</widget>
Expand All @@ -118,7 +118,7 @@ font: 12pt &quot;Segoe UI&quot;;</string>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 2px solid gray;
border-radius: 10px;
border-radius: 7px;
font: 12pt &quot;Segoe UI&quot;;</string>
</property>
<property name="echoMode">
Expand All @@ -137,7 +137,7 @@ font: 12pt &quot;Segoe UI&quot;;</string>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 2px solid gray;
border-radius: 10px;
border-radius: 7px;
font: 12pt &quot;Segoe UI&quot;;</string>
</property>
<property name="echoMode">
Expand All @@ -156,7 +156,7 @@ font: 12pt &quot;Segoe UI&quot;;</string>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 2px solid gray;
border-radius: 10px;
border-radius: 7px;
font: 12pt &quot;Segoe UI&quot;;</string>
</property>
</widget>
Expand All @@ -172,7 +172,7 @@ font: 12pt &quot;Segoe UI&quot;;</string>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 2px solid gray;
border-radius: 10px;
border-radius: 7px;
font: 12pt &quot;Segoe UI&quot;;</string>
</property>
</widget>
Expand All @@ -188,21 +188,21 @@ font: 12pt &quot;Segoe UI&quot;;</string>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 2px solid gray;
border-radius: 10px;
border-radius: 7px;
font: 12pt &quot;Segoe UI&quot;;</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_DangKy_AddUser">
<property name="geometry">
<rect>
<x>220</x>
<x>230</x>
<y>400</y>
<width>151</width>
<height>51</height>
<width>131</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-radius: 15px;
<string notr="true">border-radius: 10px;
color: rgb(255, 255, 255);
background-color: rgb(48, 165, 255);
font: 75 18pt &quot;MS Shell Dlg 2&quot;;</string>
Expand Down Expand Up @@ -239,7 +239,7 @@ font: 75 18pt &quot;MS Shell Dlg 2&quot;;</string>
<property name="styleSheet">
<string notr="true">background-image: url(:/Images/BackGr/budget.jpg);
border: 2px solid yellow;
border-radius: 50px;</string>
border-radius: 40px;</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
Expand Down
10 changes: 5 additions & 5 deletions QuanLyChiTieu/changepin.ui
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<widget class="QLabel" name="label_MaPinCu">
<property name="geometry">
<rect>
<x>110</x>
<x>113</x>
<y>100</y>
<width>91</width>
<height>41</height>
Expand All @@ -39,7 +39,7 @@
<widget class="QLabel" name="label_MaPinMoi">
<property name="geometry">
<rect>
<x>100</x>
<x>101</x>
<y>150</y>
<width>101</width>
<height>21</height>
Expand All @@ -55,7 +55,7 @@
<widget class="QLabel" name="label_NhapLaiMaPinMoi">
<property name="geometry">
<rect>
<x>30</x>
<x>33</x>
<y>190</y>
<width>161</width>
<height>21</height>
Expand Down Expand Up @@ -126,7 +126,7 @@
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-radius: 15px;
<string notr="true">border-radius: 10px;
color: rgb(255, 255, 255);
background-color: rgb(48, 165, 255);
font: 75 15pt &quot;MS Shell Dlg 2&quot;;</string>
Expand All @@ -145,7 +145,7 @@ font: 75 15pt &quot;MS Shell Dlg 2&quot;;</string>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-radius: 15px;
<string notr="true">border-radius: 10px;
color: rgb(255, 255, 255);
background-color: rgb(48, 165, 255);
font: 75 15pt &quot;MS Shell Dlg 2&quot;;</string>
Expand Down
64 changes: 4 additions & 60 deletions QuanLyChiTieu/chitieu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,55 +87,6 @@ void ChiTieu::on_btn_OK_clicked()
// Truy vấn DB
QSqlQuery qry;

lli SoDuTK = TaiKhoanQL.LaySoDu(Username,TenTaiKhoan);

SoDuTK -= SoTien;
//Lấy mã tài khoản
int MTK = TaiKhoanQL.LayMaTaiKhoan(this->Username, TenTaiKhoan);


//Kiểm tra có đủ số dư trong tài khoản hay không
if( SoDuTK < 0 ){
QMessageBox::warning(this,"Nguy hiểm",QString::fromUtf8("Số tiền chi tiêu vượt quá số dư của tài khoản này!!"));
return;
}

else{
//Trừ trong bảng TietKiem nếu có
if( TaiKhoanQL.LayLoaiTaiKhoan(this->Username, TenTaiKhoan) == "Tiết kiệm" ){
TietKiemQL.CapNhatSoDu(this->Username, MTK, SoDuTK);
}
//done

// Trừ tiền trong tài khoản
qry.prepare("UPDATE TaiKhoan SET SoDu = :SoDuTK WHERE Ten = :TenTaiKhoan AND TenChu = :Username; ");

qry.bindValue(":SoDuTK", SoDuTK);
qry.bindValue(":TenTaiKhoan", TenTaiKhoan);
qry.bindValue(":Username", Username);

qry.exec();
//done


}

//

/// Thêm tiền trong danh mục

SoTien += DanhMucQL.LaySoTienTong(MaDanhMuc, Username);

qry.prepare("UPDATE DanhMucChiTieu SET TongTien = :SoTien WHERE TenChu = :Username AND MaDanhMuc = :MaDanhMuc; ");

qry.bindValue(":SoTien", SoTien);
qry.bindValue(":Username", Username);
qry.bindValue(":MaDanhMuc", MaDanhMuc);

qry.exec();

///done

////Lấy ID_DanhMuc đưa vào bảng KhoanChi

int ID_DanhMuc = DanhMucQL.LayID_DanhMuc(MaDanhMuc, Username);
Expand All @@ -144,27 +95,20 @@ void ChiTieu::on_btn_OK_clicked()

/// Thêm vào bảng KhoanChi

qry.prepare("INSERT KhoanChi ( SoTien, NgayChiTieu, GhiChu, TenTaiKhoan, ID_DanhMuc )" "VALUES ( :SoTien, :NgayChiTieu, :GhiChu, :TenTaiKhoan, :ID_DanhMuc )");
qry.prepare("INSERT INTO KhoanChi ( SoTien, NgayChiTieu, GhiChu, TenTaiKhoan, ID_DanhMuc )" "VALUES ( :SoTien, :NgayChiTieu, :GhiChu, :TenTaiKhoan, :ID_DanhMuc )");

qry.bindValue(":SoTien", SoTien);
qry.bindValue(":NgayChiTieu", NgayChiTieu);
qry.bindValue(":GhiChu", MoTa);
qry.bindValue(":TenTaiKhoan", TenTaiKhoan);
qry.bindValue(":ID_DanhMuc", ID_DanhMuc);

qry.exec();
if( !qry.exec() ){
QMessageBox::warning(this,"Nguy hiểm",QString::fromUtf8("Số tiền chi tiêu vượt quá số dư của tài khoản này!!"));
}

///done

/// Lấy mã khoản chi
int MaKhoanChi = DanhMucQL.LayMaKhoanChi();

//Cập nhật thông tin thu nhập cho bảng ThongKe

ThongKeQL.CapNhatMaKhoanChi(this->Username, NgayChiTieu, MaKhoanChi);

//done


buttonPressed();

Expand Down
14 changes: 7 additions & 7 deletions QuanLyChiTieu/chitieu.ui
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ QComboBox::down-arrow:on { /* shift the arrow when popup is open */
<string notr="true">font: 16pt &quot;Segoe UI&quot;;
background-color: rgb(255, 255, 255);

border-radius: 10px;
border-radius: 7px;
border: 2px solid #e1eff6;</string>
</property>
<property name="placeholderText">
Expand All @@ -118,7 +118,7 @@ border: 2px solid #e1eff6;</string>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-radius: 10px;
<string notr="true">border-radius: 7px;
border: 2px solid #e1eff6;
color: rgb(0, 0, 0);
background-color: rgb(255, 255, 255);
Expand Down Expand Up @@ -173,7 +173,7 @@ font: 75 14pt &quot;Segoe UI&quot;;</string>
</property>
<property name="styleSheet">
<string notr="true">font: 14pt &quot;Segoe UI&quot;;
border-radius: 10px;
border-radius: 7px;
border: 2px solid #e1eff6;</string>
</property>
<property name="placeholderText">
Expand Down Expand Up @@ -280,14 +280,14 @@ color: rgb(0, 0, 0);</string>
<widget class="QPushButton" name="btn_OK">
<property name="geometry">
<rect>
<x>220</x>
<x>240</x>
<y>470</y>
<width>101</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-radius: 15px;
<string notr="true">border-radius: 10px;
color: rgb(255, 255, 255);
background-color: rgb(255, 106, 108);
font: 75 15pt &quot;MS Shell Dlg 2&quot;;</string>
Expand All @@ -299,14 +299,14 @@ font: 75 15pt &quot;MS Shell Dlg 2&quot;;</string>
<widget class="QPushButton" name="btn_Huy">
<property name="geometry">
<rect>
<x>360</x>
<x>380</x>
<y>470</y>
<width>101</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-radius: 15px;
<string notr="true">border-radius: 10px;
color: rgb(255, 255, 255);
background-color: rgb(255, 106, 108);
font: 75 15pt &quot;MS Shell Dlg 2&quot;;</string>
Expand Down
Loading

0 comments on commit be60091

Please sign in to comment.