private void insertTo退貨記錄(string p_str請購單號, string p_str產品編號, int p_int退貨數量)
        {
            CKGPartOrderFactory l_factory請購主檔 = _context.CFactoryManager.CKGPartOrderFactory;
            CKGPartOrder        l_code請購主檔    = l_factory請購主檔.getKGPartOrderBy請購單號(p_str請購單號);

            CKGPartOrderDetailFactory l_factory請購明細 = _context.CFactoryManager.CKGPartOrderDetailFactory;
            CKGPartOrderDetail        l_code請購明細    = l_factory請購明細.get請購單內的單一產品明細(p_str請購單號, p_str產品編號);


            CKGPartOrderDetailOutFactory l_factroy退貨記錄 = _context.CFactoryManager.CKGPartOrderDetailOutFactory;
            CKGPartOrderDetailOut        l_code退貨記錄    = l_factroy退貨記錄.createCKGPartOrderDetailOut();

            CUser l_user = Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser;

            l_code退貨記錄.f_ExchangeID請購單號      = p_str請購單號;
            l_code退貨記錄.f_SalesSmid業代員編       = l_code請購主檔.f_SalesSmid業代員編;
            l_code退貨記錄.f_SalesBranch業代單位     = l_user.f_branchid所別;
            l_code退貨記錄.f_AssistantSmid退貨助理員編 = l_user.f_userid帳號; //"F9446";//
            l_code退貨記錄.f_ProductID產品編號       = l_code請購明細.f_ProductID產品編號;
            l_code退貨記錄.f_ProductName產品名稱     = l_code請購明細.f_ProductName產品名稱;
            l_code退貨記錄.f_OutAmount退貨數量       = p_int退貨數量;
            l_code退貨記錄.f_OutDate退貨日期         = DateTime.Today.ToString("yyyy/MM/dd");
            l_code退貨記錄.f_Qty產品單位             = l_code請購明細.f_Qty產品單位;
            l_code退貨記錄.f_Cost產品成本            = l_code請購明細.f_Cost產品成本價;
            l_code退貨記錄.f_UnitPrice產品單價       = l_code請購明細.f_UnitPrice產品單價;
            l_code退貨記錄.f_ListPrice建議售價       = l_code請購明細.f_ListPrice建議售價;
            l_code退貨記錄.f_OutTotal總計退貨價格      = l_code請購明細.f_UnitPrice產品單價 * p_int退貨數量;
            l_code退貨記錄.f_OutReasons退貨原因      = iv_txt退貨原因.Text.Replace("'", "");
            l_code退貨記錄.f_Check管理者確認退貨        = "False";
            l_code退貨記錄.f_EditDate編輯日期        = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            l_factroy退貨記錄.insertCKGPartOrderDetailOut(l_code退貨記錄);
        }
Exemplo n.º 2
0
        private string 組TR(CKGPartOrderDetail p_code明細, string p_strMemo)
        {
            string l_str = "  <tr>";

            l_str += "    <td colspan=\"2\" style=\"border-style:solid; border-width:1px; font-size: 10pt\" width=\"182\" bordercolor=\"#000000\" align=\"center\">";
            l_str += "        " + 塞空白字串(p_code明細.f_ProductID產品編號) + "</td>";
            l_str += "     <td colspan=\"4\" style=\"border-style:solid; border-width:1px; font-size: 10pt\" bordercolor=\"#000000\" align=\"center\">";
            l_str += "          " + 塞空白字串(p_code明細.f_ProductName產品名稱) + "</td>";
            l_str += "     <td style=\"border-style:solid; border-width:1px; font-size: 10pt; width: 36px\" bordercolor=\"#000000\" align=\"center\">";

            CUser l_user = Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser;

            if (l_user == null)
            {
                Session.Remove(SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA);
                Response.Redirect("../FrmLogin.aspx");
            }
            if (l_user.f_lvl等級 == 4)
            {
                l_str += "          (" + 塞空白字串(p_code明細.f_SalePrice販賣價.ToString()) + ")" + p_code明細.f_UnitPrice產品單價.ToString() + "</td>";
            }
            else
            {
                l_str += "          " + 塞空白字串(p_code明細.f_UnitPrice產品單價.ToString()) + "(" + p_code明細.f_SalePrice販賣價.ToString() + ")" + "</td>";
            }

            l_str += "     <td style=\"border-style:solid; border-width:1px; font-size: 10pt; width: 42px\" bordercolor=\"#000000\" align=\"center\">";
            l_str += "         " + 塞空白字串(p_code明細.f_Amount選購數量.ToString()) + "</td>";
            l_str += "    <td style=\"border-style:solid; border-width:1px; font-size: 10pt; width: 36px\" bordercolor=\"#000000\" align=\"center\">";
            l_str += "         (" + 塞空白字串(p_code明細.f_Total總計價格.ToString()) + ")" + 塞空白字串((p_code明細.f_UnitPrice產品單價 * p_code明細.f_Amount選購數量).ToString()) + "</td>";
            if (!"".Equals(p_strMemo))
            {
                l_str += "     <td colspan=\"2\" style=\"border-style:solid; border-width:1px; font-size: 10pt\" rowspan=\"11\" bordercolor=\"#000000\" align=\"center\">";
                l_str += "          " + p_strMemo + "</td>";
            }
            l_str += "  </tr>";
            return(l_str);
        }
Exemplo n.º 3
0
        private void 送出請購清單()
        {
            DataTable l_dt = (DataTable)Session[SealedGlobalPage.SESSIONKEY_KGPARTORDER_TEMPTABLE];

            if (l_dt.Rows.Count == 0)
            {
                string l_str = "alert('清單內無任何資料,請加入請購產品至清單內');";
                ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", l_str, true);
                return;
            }
            else
            {
                CKGPartOrderFactory l_factory主檔 = _context.CFactoryManager.CKGPartOrderFactory;
                CKGPartOrder        l_code主檔    = l_factory主檔.createCKGPartOrder();

                string l_str請購單號 = "";
                CUser  l_User    = (Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser);

                l_str請購單號 = CTools.get訂單號碼(l_User.f_branchid所別);

                l_code主檔.f_ExchangeID請購單號 = l_str請購單號;

                l_code主檔.f_EngineNo引擎號碼            = iv_txt引擎號碼.Text.Trim();
                l_code主檔.f_Vendor請購廠商              = _rbl廠商.SelectedValue;
                l_code主檔.f_AssistantSmid助理員編       = l_User.f_userid帳號;//"F9446";//
                l_code主檔.f_AssistantBranchid助理單位編號 = l_User.f_branchid所別;
                l_code主檔.f_TotalPrice總計價格          = Convert.ToInt32(_lblTotal.Text);
                l_code主檔.f_SalesSmid業代員編           = _lblSmid.Text;

                l_code主檔.f_TotalSale總販賣價  = Convert.ToInt32(_lblSaleTotal.Text);
                l_code主檔.f_IsSend是否發送     = "False";
                l_code主檔.f_Memo備註說明       = _txt備註.Text.Replace("'", "");
                l_code主檔.f_InsertDate請購日期 = DateTime.Now.ToString("yyyy/MM/dd");
                l_code主檔.f_InsertIP輸入電腦IP = Request.UserHostAddress;
                l_code主檔.f_EditDate編輯日期   = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss");
                CKGPartOrderDetailFactory l_factory = _context.CFactoryManager.CKGPartOrderDetailFactory;

                CKGPartOrderDetail[] l_codes明細 = new CKGPartOrderDetail[l_dt.Rows.Count];
                int l_int主檔總計成本 = 0;

                for (int i = 0; i < l_dt.Rows.Count; i++)
                {
                    l_codes明細[i] = l_factory.createCKGPartOrderDetail();
                    l_codes明細[i].f_ExchangeID請購單號  = l_str請購單號;
                    l_codes明細[i].f_ProductID產品編號   = l_dt.Rows[i]["產品編號"].ToString();
                    l_codes明細[i].f_ProductName產品名稱 = l_dt.Rows[i]["產品名稱"].ToString();
                    l_codes明細[i].f_Amount選購數量      = Convert.ToInt32(l_dt.Rows[i]["數量"].ToString());
                    l_codes明細[i].f_Qty產品單位         = l_dt.Rows[i]["單位"].ToString();
                    l_codes明細[i].f_Cost產品成本價       = Convert.ToInt32(l_dt.Rows[i]["成本"].ToString());
                    l_codes明細[i].f_UnitPrice產品單價   = Convert.ToInt32(l_dt.Rows[i]["業代價"].ToString());
                    l_codes明細[i].f_SalePrice販賣價    = Convert.ToInt32(l_dt.Rows[i]["販賣價"].ToString());
                    l_codes明細[i].f_ListPrice建議售價   = Convert.ToInt32(l_dt.Rows[i]["建議售價"].ToString());

                    CUser l_user = Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser;
                    if (l_user == null)
                    {
                        Session.Remove(SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA);
                        Response.Redirect("../FrmLogin.aspx");
                    }
                    if (l_user.f_lvl等級 == 4)
                    {
                        l_codes明細[i].f_Total總計價格 = Convert.ToInt32(l_dt.Rows[i]["總販賣"].ToString());
                    }
                    else
                    {
                        l_codes明細[i].f_Total總計價格 = Convert.ToInt32(l_dt.Rows[i]["總計"].ToString());
                    }

                    l_codes明細[i].f_EditDate編輯日期 = l_code主檔.f_EditDate編輯日期;
                    l_int主檔總計成本 += (l_codes明細[i].f_Cost產品成本價 * l_codes明細[i].f_Amount選購數量);
                }

                l_code主檔.f_TotalCost總成本價 = l_int主檔總計成本;
                l_code主檔.明細 = l_codes明細;
                string l_str = "alert('選購作業完成,請購單號為: " + l_str請購單號 + "');";
                ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", l_str, true);

                l_factory主檔.insertCKGPartOrder(l_code主檔);
                新增應收帳款(l_code主檔);
                初始化();
            }
        }