깃랩 재정비
This commit is contained in:
220
unimarc/WindowsFormsApp1/납품관리/Book_Lookup.cs
Normal file
220
unimarc/WindowsFormsApp1/납품관리/Book_Lookup.cs
Normal file
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WindowsFormsApp1.Delivery
|
||||
{
|
||||
public struct Backup_Data
|
||||
{
|
||||
public string[] book_data;
|
||||
public void backup_set_book(string[] backup)
|
||||
{
|
||||
book_data = backup;
|
||||
}
|
||||
}
|
||||
public partial class Book_Lookup : Form
|
||||
{
|
||||
Helper_DB db = new Helper_DB();
|
||||
Backup_Data back;
|
||||
Order_input oin;
|
||||
Purchase pur;
|
||||
string compidx;
|
||||
string list_name;
|
||||
int idx;
|
||||
public Book_Lookup(Order_input _oin)
|
||||
{
|
||||
InitializeComponent();
|
||||
oin = _oin;
|
||||
idx = oin.grididx;
|
||||
compidx = oin.compidx;
|
||||
}
|
||||
public Book_Lookup(Purchase _pur)
|
||||
{
|
||||
InitializeComponent();
|
||||
pur = _pur;
|
||||
idx = pur.grididx;
|
||||
compidx = pur.compidx;
|
||||
}
|
||||
private void Book_Lookup_Load(object sender, EventArgs e)
|
||||
{
|
||||
db.DBcon();
|
||||
tb_isbn.Text = isbn();
|
||||
list_db();
|
||||
this.Text = "도서 정보 - 『" + tb_book_name.Text + "』";
|
||||
mk_Grid();
|
||||
|
||||
/* Obj_List_Book
|
||||
* idx 도서명 저자 출판사 isbn
|
||||
* 정가 수량 입고수 합계금액 비고
|
||||
* 주문처 주문일자 */
|
||||
string[] List_book = { compidx, tb_book_name.Text, tb_author.Text, tb_book_comp.Text, tb_isbn.Text,
|
||||
tb_pay.Text, tb_count.Text, tb_stock.Text, tb_total.Text, tb_etc.Text,
|
||||
tb_order1.Text, tb_order_date.Text, tb_List_name.Text };
|
||||
back.backup_set_book(List_book);
|
||||
}
|
||||
private void mk_Grid()
|
||||
{
|
||||
string Area = "`order`, `pay`, `count`, `persent`, " + // 0-3
|
||||
"`order_date`, `import_date`, `chk_date`, `export_date`"; // 4-7
|
||||
string[] Search_col = { "compidx", "list_name", "book_name", "author", "book_comp" };
|
||||
string[] Search_data = { compidx, tb_List_name.Text, tb_book_name.Text, tb_author.Text, tb_book_comp.Text };
|
||||
string db_tmp = db.More_DB_Search("Obj_List_Book", Search_col, Search_data, Area);
|
||||
string[] db_data = db_tmp.Split('|');
|
||||
|
||||
string[] add_grid = { "", "", db_data[0], db_data[1], db_data[2], db_data[3] };
|
||||
// 처리일자 구분 거래처명 단가 수량 %
|
||||
if (db_data[4] != "") {
|
||||
add_grid[0] = db_data[4];
|
||||
add_grid[1] = "주문";
|
||||
dataGridView1.Rows.Add(add_grid);
|
||||
}
|
||||
if (db_data[5] != "") {
|
||||
add_grid[0] = db_data[5];
|
||||
add_grid[1] = "입고";
|
||||
dataGridView1.Rows.Add(add_grid);
|
||||
}
|
||||
if (db_data[6] != "") {
|
||||
add_grid[0] = db_data[6];
|
||||
add_grid[1] = "검수";
|
||||
dataGridView1.Rows.Add(add_grid);
|
||||
}
|
||||
if (db_data[7] != "") {
|
||||
add_grid[0] = db_data[7];
|
||||
add_grid[1] = "출고";
|
||||
dataGridView1.Rows.Add(add_grid);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 폼에 들어갈 데이터를 사전에 준비하여야함.
|
||||
/// </summary>
|
||||
/// <param name="book_name"></param>
|
||||
/// <param name="author"></param>
|
||||
/// <param name="book_comp"></param>
|
||||
/// <param name="list_name"></param>
|
||||
public void Lookup_Load(string book_name, string author, string book_comp, string list_name)
|
||||
{
|
||||
this.list_name = list_name;
|
||||
db.DBcon();
|
||||
string search = "`book_name`, `author`, `book_comp`, `count`, `pay`, " +
|
||||
"`total`, `header`, `num`, `order`, `etc`, `input_count`, `order_date`";
|
||||
|
||||
string[] data = { compidx, book_name, author, book_comp, list_name };
|
||||
string[] table = { "compidx", "book_name", "author", "book_comp", "list_name" };
|
||||
string tmp_db = db.More_DB_Search("Obj_List_Book", table, data, search);
|
||||
mk_Lookup(tmp_db);
|
||||
}
|
||||
private void mk_Lookup(string values)
|
||||
{
|
||||
string[] data = values.Split('|');
|
||||
|
||||
tb_book_name.Text = data[0];
|
||||
tb_author.Text = data[1];
|
||||
tb_book_comp.Text = data[2];
|
||||
tb_count.Text = data[3];
|
||||
tb_pay.Text = data[4];
|
||||
tb_total.Text = data[5];
|
||||
tb_num.Text = data[6] + " " + data[7];
|
||||
tb_order1.Text = data[8];
|
||||
tb_etc.Text = data[9];
|
||||
tb_stock.Text = data[10];
|
||||
if (data[11].Length < 3) { tb_order_date.Text = ""; }
|
||||
else { tb_order_date.Text = data[11].Substring(0, 10); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 목록db에서 불러온 값을 적용시키는 함수
|
||||
/// </summary>
|
||||
private void list_db()
|
||||
{
|
||||
string[] where_table = { "comp_num", "list_name" };
|
||||
string[] search_data = { compidx, list_name };
|
||||
string cmd = db.More_DB_Search("Obj_List", where_table, search_data,
|
||||
"`clt`, `dly`, `charge`, `date`, `date_res`");
|
||||
string[] data = cmd.Split('|');
|
||||
tb_List_name.Text = list_name;
|
||||
tb_charge.Text = data[2];
|
||||
tb_date.Text = data[3];
|
||||
tb_date_res.Text = data[4];
|
||||
}
|
||||
/// <summary>
|
||||
/// 목록도서DB에 저장된 isbn값을 가져오는 함수.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string isbn()
|
||||
{
|
||||
string[] where_table = { "compidx", "list_name", "book_name", "author", "book_comp" };
|
||||
string[] search_data = { compidx,
|
||||
list_name, tb_book_name.Text, tb_author.Text, tb_book_comp.Text };
|
||||
string cmd = db.More_DB_Search("Obj_List_Book", where_table, search_data, "`isbn`");
|
||||
cmd = cmd.Replace("|", "");
|
||||
return cmd;
|
||||
}
|
||||
private void Book_Lookup_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
btn_close_Click(null, null);
|
||||
}
|
||||
if (e.KeyCode == Keys.Control)
|
||||
{
|
||||
if (e.KeyCode == Keys.S)
|
||||
{
|
||||
btn_save_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void btn_save_Click(object sender, EventArgs e)
|
||||
{
|
||||
/* Obj_List_Book
|
||||
* idx 도서명 저자 출판사 isbn
|
||||
* 정가 수량 입고수 합계금액 비고
|
||||
* 주문처 주문일자 */
|
||||
string[] Table = { "compidx", "book_name", "author", "book_comp", "isbn",
|
||||
"pay", "count", "input_count", "total", "etc",
|
||||
"order", "order_date", "list_name" };
|
||||
string[] List_book = { compidx, tb_book_name.Text, tb_author.Text, tb_book_comp.Text, tb_isbn.Text,
|
||||
tb_pay.Text, tb_count.Text, tb_stock.Text, tb_total.Text, tb_etc.Text,
|
||||
tb_order1.Text, tb_order_date.Text, tb_List_name.Text };
|
||||
|
||||
db.More_Update("Obj_List_Book", Table, List_book, Table, back.book_data);
|
||||
MessageBox.Show("저장되었습니다.");
|
||||
}
|
||||
private void btn_close_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
private void btn_stock_Click(object sender, EventArgs e)
|
||||
{
|
||||
int stock = Convert.ToInt32(tb_stock.Text);
|
||||
stock += 1;
|
||||
tb_stock.Text = stock.ToString();
|
||||
/* // 저장버튼 클릭시 일괄저장되는걸로 변경 (소스는 혹시 몰라 주석처리)
|
||||
string[] edit_tbl = { "input_count", "import", "import_date" };
|
||||
string[] edit_col = { stock.ToString(), "입고", DateTime.Today.ToString("G").Substring(0,10) };
|
||||
string[] search_tbl = { "compidx", "list_name", "book_name", "author", "book_comp", "isbn" };
|
||||
string[] search_col = { compidx,
|
||||
tb_List_name.Text, tb_book_name.Text, tb_author.Text, tb_book_comp.Text, tb_isbn.Text };
|
||||
db.More_Update("Obj_List_Book", edit_tbl, edit_col, search_tbl, search_col);
|
||||
MessageBox.Show(tb_book_name.Text + "가 입고처리되었습니다.");
|
||||
mk_Grid();
|
||||
*/
|
||||
}
|
||||
private void btn_order_ccl_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 저장버튼 클릭시 일괄 저장.
|
||||
tb_order1.Text = "";
|
||||
tb_order_date.Text = "";
|
||||
tb_order_idx.Text = "";
|
||||
}
|
||||
private void btn_order_Click(object sender, EventArgs e)
|
||||
{
|
||||
tb_order_date.Text = DateTime.Now.ToString("G").Substring(0, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user