示例#1
0
        //--------------------------------------------------------//
        //      Method
        //--------------------------------------------------------//
        public string NumberingOrder(string officeCode, string department)
        {
            string orderNo = department;

            if (officeCode != "H")
            {
                orderNo = "A";
            }

            orderNo += util.TruncateByteRight(Convert.ToString(DHandling.FiscalYear(DateTime.Today)), 2);
            orderNo += officeCode;
            SqlHandling sh = new SqlHandling("M_Office");
            DataTable   dt = sh.SelectAllData("WHERE OfficeCode = '" + officeCode + "'");

            if (dt == null)
            {
                return(null);
            }
            DataRow dr;

            dr = dt.Rows[0];
            int orderSeqNo = Convert.ToInt32(dr["OrderSeqNo"]);

            orderSeqNo++;
            orderNo += orderSeqNo.ToString("000");

            if (!office_Update(officeCode, orderSeqNo))
            {
                return(null);
            }

            return(orderNo);
        }
示例#2
0
文件: GenericData.cs 项目: kyas21/FTB
        private string editTextLine()
        {
            // 2018.01 asakawa 数値がマイナスの場合の出力形式の修正のために一部変更

            string textLine = "";

            // 伝区
            textLine += "0";
            // 年号
            textLine += "1";
            // 売上年月日
            string date = ReportDate.ToShortDateString();

            textLine += util.TruncateByteRight(DHandling.RemoveNoNum(date), 6);             // yyyymmdd →yymmdd
            // 請求年月日
            textLine += util.TruncateByteRight(DHandling.RemoveNoNum(date), 6);             // yyyymmdd →yymmdd
            // 伝票番号 6桁、0Padding
            textLine += util.PaddingInBytes(Convert.ToString(SlipNo), "Number", 6);

            // 得意先コード(業務No)
            textLine += TaskCode;

            // 得意先名
            char[] strChar = TaskName.ToCharArray();
            for (int i = 0; i < strChar.Length; i++)
            {
                if (strChar[i] == ' ')
                {
                    strChar[i] = ' ';
                }
            }
            TaskName = new string( strChar );
            //string taskData = util.FormFixedByteLengthLeft("(" + CostType + ")" + TaskName, 68);
            string taskData = util.FormFixedByteLengthLeft(TaskName, 68);

            textLine += util.TruncateByteLeft(taskData, 40);
            // 先方担当者名
            textLine += util.TruncateByteRight(taskData, 28);
            // 部門コード
            int dIdx = Array.IndexOf(sdKeyArray, (OfficeCode + util.SubstringByte(TaskCode, 0, 1)));

            if (dIdx < 0)
            {
                dIdx = Array.IndexOf(sdKeyArray, (OfficeCode + " "));
            }
            textLine += sDeptArray[dIdx];
            // 担当者コード
            //string pCode = Conv.ResizeMemberCode(MemberCode.TrimEnd(),2);
            textLine += Conv.ResizeMemberCode(LeaderMCode.TrimEnd(), 2);
            // 摘要コード
            textLine += "00";
            // 摘要名
            textLine += util.PaddingInBytes(" ", "Char", 30);
            // 商品コード
            textLine += util.SubstringByte(ItemCode, 0, 4);
            // マスター区分
            textLine += "0";
            // 品名
            if (ItemCode.TrimEnd() == "K999")
            {
                char checkChar = ' ';
                if (Item != "")
                {
                    checkChar = Item[0];
                }
                string kItem = (checkChar == '●') ? Item : kMark + Item;
                textLine += util.FormFixedByteLengthLeft(kItem, 36);
            }
            else
            {
                textLine += util.FormFixedByteLengthLeft(Item, 36);
            }
            //textLine += util.PaddingInBytes(Item, "Char", 36);
            //textLine += util.FormFixedByteLengthLeft(Item, 36);
            // 区
            textLine += "0";
            // 入数
            textLine += "0000";
            // 箱数
            textLine += "00000";
            // 数量
            if (Quantity == 0)
            {
                Quantity = 1;                        // 0では商魂汎用データ作成時にエラーになる
            }
            // 2018.01 asakawa マイナス値の場合の出力形式の修正のために変更
            // textLine += util.PaddingInBytes( Convert.ToString( Quantity ), "Number", 9 );
            if (Quantity < 0)
            {
                textLine += "-";
                decimal qq = Quantity * (-1);
                textLine += util.PaddingInBytes(Convert.ToString(qq), "Number", 8);
            }
            else
            {
                textLine += util.PaddingInBytes(Convert.ToString(Quantity), "Number", 9);
            }
            // 単位
            textLine += util.PaddingInBytes(Unit, "Char", 4);
            // 単価
            // 2018.01 asakawa マイナス値の場合の出力形式の修正のために変更
            // textLine += util.PaddingInBytes( UnitPrice.ToString( "0" ), "Number", 10 );
            if (UnitPrice < 0)
            {
                textLine += "-";
                decimal pp = UnitPrice * (-1);
                // textLine += util.PaddingInBytes(Convert.ToString(pp), "Number", 9); // 小数点以下も出力される
                textLine += util.PaddingInBytes(pp.ToString("0"), "Number", 9);
            }
            else
            {
                textLine += util.PaddingInBytes(UnitPrice.ToString("0"), "Number", 10);
            }
            // 売上金額
            int sales = Convert.ToInt32(Quantity * UnitPrice);

            // 2018.01 asakawa マイナス値の場合の出力形式の修正のために変更
            // textLine += util.PaddingInBytes( Convert.ToString( sales ), "Number", 10 );
            if (sales < 0)
            {
                textLine += "-";
                textLine += util.PaddingInBytes(Convert.ToString(sales * (-1)), "Number", 9);
            }
            else
            {
                textLine += util.PaddingInBytes(Convert.ToString(sales), "Number", 10);
            }
            // 原単価
            textLine += util.PaddingInBytes("0", "Number", 9);
            // 原価額
            textLine += util.PaddingInBytes("0", "Number", 10);
            // 税区分
            textLine += "0";
            // 税込区分
            textLine += "0";
            // 備考区分
            textLine += "1";        //備考区分が0:備考は数字、1:文字1
            // 備考
            textLine += util.PaddingInBytes(" ", "Char", 9);
            // 同時入荷区分
            textLine += "0";

            return(textLine);
        }