=====* unimarc *=====
===== 작업중 ===== 주문관리 폼 재 수정작업중 - 팩스 및 이메일 기록 폼 제작해야함. - 제작완료 (현재 목록등록 -> 수정버튼 작업중) ㄴ> 작업 완료후 검토하고, 회계로 넘어갈 것. - 회계전환 ㄴ> 회계전환. 매출상세(Sales_Detail.cs) 폼 작업중. ===== 보류 ===== b. 마크목록 폼 작성중 1. 엑셀반출 기능 추가중 사용 작업대기중 c. 마크 반입 폼 수정중 1. 불러오기는 되나 저장 기능이 필요함. ===== 완료 ===== 1. 주문관리 팩스연동 완료 2. 전송된 팩스 확인 작업개시, 이메일 전송모듈 수정완료. 3. 주문관리에서 주문처와 목록 검색하는 폼 검색 모듈도 재수정 완료함. 4. 데이터베이스 내 이미지URL을 가져오는작업 완료 목록집계 폼 재 수정작업 완료 - 확인 및 수정 필요. ISBN 체크 프로그램 => 본프로그램에 이식중. ㄴ> 코드는 다 옮겼으나 기존 사용하던 방식과 조금 달라서 버그발생 가능성 있음. ㄴ> 버그 체크 계속 해볼것. 21-04-15 ㄴ> 21_04_20 버그 없음. 2. 마크편집 폼 수정 중 (마크 반출 test프로젝트 진행완료, 본 프로젝트에 적용중. / 저장기능활성화 작업완료) 2-1. 기존의 칸채우기에서 예상되지 못한 버그가 발생하여 칸채우기 숨김. 2-2. 008태크 재배치 => TextBox에 적용완료. 변경사항 메모장으로 넘기는 작업 완료. 2-3. 저장기능 완료. (04.14 체크해볼것 - 완료) 주문관리 작업중 (DataGridView 주문처 엔터키 입력시 검색되게끔 하는 코드작성중) - 21.04.27 완료
This commit is contained in:
@@ -7,164 +7,177 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.Account;
|
||||
|
||||
// 추가된 참조
|
||||
using WindowsFormsApp1.Delivery;
|
||||
|
||||
namespace WindowsFormsApp1.Account
|
||||
namespace WindowsFormsApp1.회계
|
||||
{
|
||||
public partial class Sales_Book : Form
|
||||
{
|
||||
public string compidx;
|
||||
Main main;
|
||||
Sales_Deposit sd;
|
||||
Helper_DB db = new Helper_DB();
|
||||
public string compidx;
|
||||
public int row = -1;
|
||||
public Sales_Book(Main _main)
|
||||
{
|
||||
InitializeComponent();
|
||||
main = _main;
|
||||
compidx = main.com_idx;
|
||||
}
|
||||
public Sales_Book(Sales_Deposit _sd)
|
||||
{
|
||||
InitializeComponent();
|
||||
sd = _sd;
|
||||
compidx = sd.compidx;
|
||||
}
|
||||
private void Sales_Book_Load(object sender, EventArgs e)
|
||||
{
|
||||
db.DBcon();
|
||||
Start_Date.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
|
||||
}
|
||||
public void btn_Lookup_Click(object sender, EventArgs e)
|
||||
{
|
||||
string table = "`date`, `client`, `tel`, `book_name`, `in_per`, " +
|
||||
"`out_per`, `in_price`, `out_price`, `total`, `etc`";
|
||||
string start = Start_Date.Text.Substring(0, 10);
|
||||
string end = End_Date.Text.Substring(0, 10);
|
||||
|
||||
string data_base = db.Search_Date("Sales", table, "date", start, end, compidx);
|
||||
input_Grid(data_base);
|
||||
dataGridView1.Rows.Clear();
|
||||
// grid
|
||||
// [0]매출일자 / [1]내용 / [2]수량 / [3]출고율 / [4]매출금액 / [5]입금액 / [6]현잔액 / [7]비고
|
||||
string[] grid = { "", "", "", "", "", "", "", "" };
|
||||
// db
|
||||
// [0]매출일자 / [1]책이름 / [2]수량 / [3]출고율 / [4]매출금액 / [5]입금액 / [6]비고 / [7]입금구분
|
||||
string Area = "`date`, `book_name`, `count`, `out_per`, `out_price`, `deposit`, `etc`, `gu`";
|
||||
string[] sear_col = { "compidx", "client" };
|
||||
string[] sear_data = { compidx, tb_clt.Text };
|
||||
string db_tmp = db.More_DB_Search("Sales", sear_col, sear_data, Area);
|
||||
string[] ary = db_tmp.Split('|');
|
||||
input_grid(grid, ary);
|
||||
}
|
||||
private void input_Grid(string value)
|
||||
#region btn_Lookup_Click_Sub
|
||||
private void input_grid(string[] grid, string[] db)
|
||||
{
|
||||
/* 조회기간, 매출거래처, 전화번호, 내용, 수량, 총액
|
||||
* 입고율, 출고율, 매입금액, 매출금액, 차이, 비고 */
|
||||
string[] grid = { "", "", "", "", "", "",
|
||||
"", "", "", "", "", "" };
|
||||
|
||||
string[] data = { "", "", "", "", "",
|
||||
"", "", "", "", "" };
|
||||
|
||||
string[] ary = value.Split('|');
|
||||
int cot = 10;
|
||||
for(int a = 0; a < ary.Length; a++)
|
||||
int count = 8;
|
||||
for(int a = 0; a < db.Length; a++)
|
||||
{
|
||||
if (a % cot == 0) { data[0] = ary[a]; }
|
||||
if (a % cot == 1) { data[1] = ary[a]; }
|
||||
if (a % cot == 2) { data[2] = ary[a]; }
|
||||
if (a % cot == 3) { data[3] = ary[a]; }
|
||||
if (a % cot == 4) { data[4] = ary[a]; }
|
||||
if (a % cot == 5) { data[5] = ary[a]; }
|
||||
if (a % cot == 6) { data[6] = ary[a]; }
|
||||
if (a % cot == 7) { data[7] = ary[a]; }
|
||||
if (a % cot == 8) { data[8] = ary[a]; }
|
||||
if (a % cot == 9) { data[9] = ary[a];
|
||||
if (tb_clt.Text != "")
|
||||
{
|
||||
if (data[1] != tb_clt.Text) { continue; }
|
||||
if (a % count == 0) { grid[0] = db[a]; }
|
||||
if (a % count == 1) { grid[1] = db[a]; }
|
||||
if (a % count == 2) { grid[2] = db[a]; }
|
||||
if (a % count == 3) { grid[3] = db[a]; }
|
||||
if (a % count == 4) { grid[4] = db[a]; }
|
||||
if (a % count == 5) { grid[5] = db[a]; }
|
||||
if (a % count == 6) { grid[7] = db[a]; }
|
||||
if (a % count == 7) {
|
||||
if (db[a] != "") {
|
||||
grid[1] = "입금 " + db[a];
|
||||
}
|
||||
grid_data_check(grid, data);
|
||||
set_grid(grid);
|
||||
}
|
||||
}
|
||||
set_now_money(dataGridView1.Rows.Count);
|
||||
}
|
||||
private void grid_data_check(string[] grid, string[] data)
|
||||
private void set_grid(string[] grid)
|
||||
{
|
||||
/* data: 0.출고일자 / 1.거래처 / 2.전화번호 / 3.내용 / 4.입고율 /
|
||||
* 5.출고율 / 6.입고금액 / 7.출고금액 / 8.합계 / 9.비고
|
||||
*
|
||||
*
|
||||
* grid: 0.조회기간 / 1.거래처 / 2.전화번호 / 3.내용 / 4.수량 /
|
||||
* 5.총합계 / 6.입고율 / 7.출고율 / 8.매입금액 / 9.매출금액 / 10.차이 / 11.비고
|
||||
*
|
||||
* out_date / clt / tel / content / count /
|
||||
* total / in_per / out_per / in_price / out_price / dif / etc
|
||||
*/
|
||||
if (data[3] == "" && data[5] == "0") { return; }
|
||||
DateTime start = Start_Date.Value;
|
||||
DateTime end = End_Date.Value;
|
||||
DateTime sear = Convert.ToDateTime(grid[0]);
|
||||
|
||||
if (dataGridView1.Rows.Count <= 0)
|
||||
bool date_chk = false;
|
||||
|
||||
if (sear >= start && sear < end) { date_chk = true; }
|
||||
if (sear > end) { return; }
|
||||
|
||||
int row = accord_grid(grid);
|
||||
if (date_chk)
|
||||
{
|
||||
base_Setting(grid, data);
|
||||
return;
|
||||
}
|
||||
int out_price = Convert.ToInt32(grid[4]);
|
||||
int in_price = Convert.ToInt32(grid[5]);
|
||||
if (row > 0) {
|
||||
int ori_out_price = Convert.ToInt32(dataGridView1.Rows[row].Cells["out_price"].Value.ToString());
|
||||
int ori_in_price = Convert.ToInt32(dataGridView1.Rows[row].Cells["in_price"].Value.ToString());
|
||||
|
||||
out_price += ori_out_price;
|
||||
in_price += ori_in_price;
|
||||
|
||||
dataGridView1.Rows[row].Cells["out_price"].Value = out_price.ToString();
|
||||
dataGridView1.Rows[row].Cells["in_price"].Value = in_price.ToString();
|
||||
}
|
||||
if (row <= 0) {
|
||||
dataGridView1.Rows.Add(grid);
|
||||
}
|
||||
}
|
||||
else if (!date_chk)
|
||||
{
|
||||
set_remain(grid);
|
||||
}
|
||||
}
|
||||
private void set_remain(string[] grid)
|
||||
{
|
||||
if (dataGridView1.Rows.Count <= 0) {
|
||||
string[] grid_base = { "이월미수금", "", "", "", "", "", "0", "" };
|
||||
dataGridView1.Rows.Add(grid_base);
|
||||
}
|
||||
int out_price = Convert.ToInt32(grid[4]);
|
||||
int in_price = Convert.ToInt32(grid[5]);
|
||||
int result = Convert.ToInt32(dataGridView1.Rows[row].Cells["now_money"].Value.ToString());
|
||||
result += out_price - in_price;
|
||||
dataGridView1.Rows[0].Cells["now_money"].Value = result.ToString();
|
||||
}
|
||||
private void set_now_money(int count)
|
||||
{
|
||||
for(int a = 0; a < count; a++)
|
||||
{
|
||||
if(a <= 0) { continue; }
|
||||
int cout = Convert.ToInt32(dataGridView1.Rows[a].Cells["count"].Value.ToString());
|
||||
int out_price = Convert.ToInt32(dataGridView1.Rows[a].Cells["out_price"].Value.ToString());
|
||||
int in_price = Convert.ToInt32(dataGridView1.Rows[a].Cells["in_price"].Value.ToString());
|
||||
int money = Convert.ToInt32(dataGridView1.Rows[a - 1].Cells["now_money"].Value.ToString());
|
||||
|
||||
set_total(cout, out_price, in_price);
|
||||
|
||||
money += out_price - in_price;
|
||||
|
||||
dataGridView1.Rows[a].Cells["now_money"].Value = money.ToString();
|
||||
}
|
||||
}
|
||||
private void set_total(int count, int out_price, int in_price)
|
||||
{
|
||||
int text_count = Convert.ToInt32(tb_count.Text.Replace(",", ""));
|
||||
int text_out = Convert.ToInt32(tb_out.Text.Replace(",", ""));
|
||||
int text_in = Convert.ToInt32(tb_in.Text.Replace(",", ""));
|
||||
|
||||
text_count += count;
|
||||
text_out += out_price;
|
||||
text_in += in_price;
|
||||
|
||||
tb_count.Text = text_count.ToString();
|
||||
tb_out.Text = text_out.ToString();
|
||||
tb_in.Text = text_in.ToString();
|
||||
}
|
||||
private int accord_grid(string[] grid)
|
||||
{
|
||||
int result = 0;
|
||||
bool[] check_list = { false, false, false };
|
||||
for(int a = 0; a < dataGridView1.Rows.Count; a++)
|
||||
{
|
||||
if (dataGridView1.Rows[a].Cells["out_date"].Value.ToString() == data[0] &&
|
||||
dataGridView1.Rows[a].Cells["clt"].Value.ToString() == data[1] &&
|
||||
dataGridView1.Rows[a].Cells["tel"].Value.ToString() == data[2]) {
|
||||
|
||||
int count = Convert.ToInt32(dataGridView1.Rows[a].Cells["count"].Value.ToString());
|
||||
int total = Convert.ToInt32(dataGridView1.Rows[a].Cells["total"].Value.ToString());
|
||||
int in_per = Convert.ToInt32(dataGridView1.Rows[a].Cells["in_per"].Value.ToString());
|
||||
int out_per = Convert.ToInt32(dataGridView1.Rows[a].Cells["out_per"].Value.ToString());
|
||||
|
||||
count++;
|
||||
total = total + Convert.ToInt32(data[8]);
|
||||
in_per = (in_per + Convert.ToInt32(data[4])) / count;
|
||||
out_per = (out_per + Convert.ToInt32(data[5])) / count;
|
||||
int in_price = persent(in_per, total);
|
||||
int out_price = persent(out_per, total);
|
||||
int dif = out_price - in_price;
|
||||
|
||||
dataGridView1.Rows[a].Cells["content"].Value = data[3];
|
||||
dataGridView1.Rows[a].Cells["count"].Value = count.ToString();
|
||||
dataGridView1.Rows[a].Cells["total"].Value = total.ToString();
|
||||
dataGridView1.Rows[a].Cells["in_per"].Value = in_per.ToString();
|
||||
dataGridView1.Rows[a].Cells["out_per"].Value = out_per.ToString();
|
||||
dataGridView1.Rows[a].Cells["in_price"].Value = in_price.ToString();
|
||||
dataGridView1.Rows[a].Cells["out_price"].Value = out_price.ToString();
|
||||
dataGridView1.Rows[a].Cells["dif"].Value = dif.ToString();
|
||||
return;
|
||||
if (dataGridView1.Rows[a].Cells["out_date"].Value.ToString() == grid[0]) {
|
||||
check_list[0] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
base_Setting(grid, data);
|
||||
return;
|
||||
if (dataGridView1.Rows[a].Cells["out_per"].Value.ToString() == grid[3]) {
|
||||
check_list[1] = true;
|
||||
}
|
||||
if (dataGridView1.Rows[a].Cells["etc"].Value.ToString() == grid[7]) {
|
||||
check_list[2] = true;
|
||||
}
|
||||
if (check_list[0] && check_list[1] && check_list[2]) {
|
||||
result = a;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private void base_Setting(string[] grid, string[] data)
|
||||
{
|
||||
grid[0] = data[0];
|
||||
grid[1] = data[1];
|
||||
grid[2] = data[2];
|
||||
grid[3] = data[3];
|
||||
grid[4] = "1";
|
||||
grid[5] = data[8];
|
||||
grid[6] = data[4];
|
||||
grid[7] = data[5];
|
||||
grid[8] = data[6];
|
||||
grid[9] = data[7];
|
||||
int dif = Convert.ToInt32(grid[9]) - Convert.ToInt32(grid[8]);
|
||||
grid[10] = dif.ToString();
|
||||
grid[11] = data[9];
|
||||
|
||||
dataGridView1.Rows.Add(grid);
|
||||
return;
|
||||
}
|
||||
private int persent(int per, int total)
|
||||
{
|
||||
return per * total / 100;
|
||||
}
|
||||
#endregion
|
||||
private void btn_Close_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
private void textBox1_KeyDown(object sender, KeyEventArgs e)
|
||||
private void tb_count_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter) {
|
||||
Commodity_Search cs = new Commodity_Search(this);
|
||||
cs.Clinet_name = tb_clt.Text;
|
||||
cs.Show();
|
||||
}
|
||||
}
|
||||
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
|
||||
String_Text st = new String_Text();
|
||||
st.Int_Comma(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user